Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write nested Graph API request

I am trying to create nested FB Graph API request to get images for public event. The full JSON object is given at this gist: https://gist.github.com/ZeKoU/be92b88440a6ca3d6be3

What I am trying to do is to get only data.0.images object, i.e. I want to get first object from data , then to get images array, and then to pick some fields from there (source for example).

However, all my attempts (see picture below) are returning only two fields for each object inside data field.

Don't know how to get images for first data object...

like image 804
azec-pdx Avatar asked Apr 15 '26 00:04

azec-pdx


1 Answers

Not sure what you're trying to do, but from what I understood the query

/310897782446456?fields=photos.fields(id,images{source}).limit(1)

should be an example of getting the first photo, extract only some fields from the object (id and images for example), and then get a single field (source for example) from the images array's objects.

  • https://developers.facebook.com/tools/explorer?method=GET&path=310897782446456%3Ffields%3Dphotos.fields(id%2Cimages%7Bsource%7D).limit(1)&version=v2.3

See

  • https://developers.facebook.com/docs/graph-api/using-graph-api/v2.3#fieldexpansion
like image 119
Tobi Avatar answered Apr 16 '26 19:04

Tobi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!