Ran
Ran

Reputation: 1089

fields parameter not working with graph batch requests

I have moved my graph requests to a batch, and noticed that when more than one request parameter is passed, the request fails with error 400.

For example, this works when not batched:

facebook->api('/me/friends?limit=5000&fields=id')

But when the same graph url is moved to a batch request, I get a 400 error.

When I remove one of the parameters (either fields or limit), it works:

/me/friends?fields=id
/me/friends?limit=10

Anyone knows if this is a bug or should be like this for some reason?

Upvotes: 0

Views: 491

Answers (1)

Ran
Ran

Reputation: 1089

Finally found the answer to my problem. It appears that the & char must be escaped with %26 in order for this to work.

So my code sample should be:

facebook->api('/me/friends?limit=5000%26fields=id')

Wish this was documented...

Upvotes: 1

Related Questions