How to write nested Graph API request

南楼画角 提交于 2020-01-02 10:05:11

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/29274598/how-to-write-nested-graph-api-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!