2

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.

Mik378
  • 21,881
  • 15
  • 82
  • 180

2 Answers2

3

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!

mwp
  • 8,217
  • 20
  • 26
0

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.

Enda Farrell
  • 778
  • 9
  • 15