0

如何为我的批处理请求的第二部分定义请求的字段?

例子:

[
  {
    "method": "GET",
    "name": "get-friends",
    "relative_url": "me/friends?limit=5",
    "omit_response_on_success": false
  },
  {
    "method": "GET",
    "relative_url": "?ids={result=get-friends:$.data.*.id}"
  }
]

到目前为止,这有效。但现在我想为第二部分定义请求的字段。

当我添加&fields=address( "relative_url": "?ids={result=get-friends:$.data.*.id}&fields=address") 我得到一个"Batch parameter must be a JSON array"例外:-(

拉尔夫

4

1 回答 1

1

我收到“批处理参数必须是 JSON 数组”异常

这可能只是意味着您的查询无法被理解,因为您以某种方式使语法无效。&在 URL 中具有特殊含义,因此您很可能只需要对其进行正确编码。

对参数的整个值进行 URL 编码batch(基本上是从对象中获得的整个 JSON 字符串。)

(为此使用什么功能/方法,取决于您如何构建您的请求,分别用什么语言。PHP 有urlencode,JavaScript 有encodeURIComponent,等等)

于 2015-08-07T08:40:08.013 回答