Mik378
Mik378

Reputation: 22171

Should include_headers be placed that way?

Hitting the Facebook graph api with a batched request:

curl -F 'access_token=mytoken' -F 'batch=[{ "method":"GET","relative_url":"me?fields=name,first_name,last_name,picture.width(100).height(100),email", "include_headers":"false"},
{ "method":"GET","relative_url":"me?fields=picture.type(large)", "include_headers":"false"}]'     https://graph.facebook.com/v2.2

The result still contain the headers.
I don't expect them in the result.

Is the "include_headers":"false" syntax wrong or misplaced?

Thanks a lot.

Upvotes: 2

Views: 820

Answers (2)

Enda Farrell
Enda Farrell

Reputation: 898

If you're using the python facebook-sdk this does the trick:

rezs = self.graph.request("?include_headers=false",
                          post_args={"batch": batched_requests})

where my self.graph is:

self.graph = facebook.GraphAPI(access_token=access_token,
                                   version="2.5")

and the batched_requests is a string containing the IDs and fields that I want.

Upvotes: 0

mwp
mwp

Reputation: 8467

I was able to exclude the headers in batch requests a few different ways. I'm doing it from the PHP SDK but it's all the same under the covers.

  1. By passing it as a POST parameter on the top-level request, i.e. add -F "include_headers=false" to your curl command
  2. By passing it as a GET parameter on the inner request(s), not as a separate field, i.e. append "&include_headers=false" to relative_url

Hope that helps!

Upvotes: 3

Related Questions