在SugarCRM中传递select字段数组时获得null响应

时间:2016-07-27 07:27:16

标签: arrays web-services sugarcrm

我正在尝试使用rest API v4_1从Sugar-CRM获取get_entry。 当我尝试在select_fields中传递值时,我得到null响应.. 当我通过空的select_fields数组时,我得到了一个成功的响应..

这是我的代码

{
  "output": {
    "status": "1",
    "GolfCourseTee": {
      "Men": [
        {
          "tee_id": 2,
          "tee_name": "Blue",
          "tee_color": "#000099"
        },
        {
          "tee_id": 4,
          "tee_name": "Yellow",
          "tee_color": "#FFFF00"
        },
        {
          "tee_id": 5,
          "tee_name": "White",
          "tee_color": "#FFFFFF"
        },
        {
          "tee_id": 1,
          "tee_name": "Black",
          "tee_color": "#000000"
        },
        {
          "tee_id": 3,
          "tee_name": "Red",
          "tee_color": "#FF0000"
        }
      ],
      "Ladies": [
        {
          "tee_id": 2,
          "tee_name": "Blue",
          "tee_color": "#000099"
        },
        {
          "tee_id": 4,
          "tee_name": "Yellow",
          "tee_color": "#FFFF00"
        },
        {
          "tee_id": 5,
          "tee_name": "White",
          "tee_color": "#FFFFFF"
        },
        {
          "tee_id": 1,
          "tee_name": "Black",
          "tee_color": "#000000"
        },
        {
          "tee_id": 3,
          "tee_name": "Red",
          "tee_color": "#FF0000"
        }
      ],
      "Junior": [
        {
          "tee_id": 2,
          "tee_name": "Blue",
          "tee_color": "#000099"
        },
        {
          "tee_id": 4,
          "tee_name": "Yellow",
          "tee_color": "#FFFF00"
        },
        {
          "tee_id": 5,
          "tee_name": "White",
          "tee_color": "#FFFFFF"
        },
        {
          "tee_id": 1,
          "tee_name": "Black",
          "tee_color": "#000000"
        },
        {
          "tee_id": 3,
          "tee_name": "Red",
          "tee_color": "#FF0000"
        }
      ]
    },
    "message": "Golf Course Tee List."
  }
}

当我在select_fields中传递空数组时,上面的代码成功地给了我响应。

注意:我在上面更改了会话,ID,邮递员令牌。这些不是实际值。

1 个答案:

答案 0 :(得分:1)

看看service/v3_1/SugarWebServiceImplv3_1.php那里定义了api v4.1的函数get_entry。据我所知,你应该传递一系列字段。

以后,他们会在函数service/core/SoapHelperWebService.php中由get_name_value_list_for_fields处理。

尝试选择字段':[' id',' name',...]