Search code examples
facebook-graph-apifacebook-marketing-api

Facebook-marketing api - need access to type of creative format


I have a requirement in which I need to access the creative format type for each adCreative. I explored the API and figured that this information is stored in Ad Creative Object Story Spec, however, I am not able to query this object.

This is the request I am making

https://graph.facebook.com/v2.11/<account_id>/adcreatives?fields=id,adset_id,name,creative,image_crops,object_story_id,image_url,image_hash,object_type,object_id,object__story_id,object_url&limit=500&access_token=<access_token>

This is not returning object_story_id and object_story_spec field only. What am I missing here?

Thanks in advance.


Solution

  • Request those fields on the adcreative edge itself. ie your first call will return a list of adcreative ids.

    { "data": [ { "id": "23842732907210427" }, { "id": "23842732907020427" }]}

    So you would call graph.facebook.com/23842732907210427?fields=object_story_id&access_token=USERACCESSTOKEN to retrieve the spec for that ad creative.

    You can also nest queries so you may be able to retrieve the spec in a single call but I have been unsuccessful attempting this. https://developers.facebook.com/docs/graph-api/using-graph-api