2

I'm using Facebook Marketing Api and I can not retrieve AdCreative object's object_story_spec field as described in docs here: https://developers.facebook.com/docs/marketing-api/reference/ad-creative

Though object_story_spec field itself seems to be a perfectly OK:

 $creative = new AdCreative($ad->creative['id']);
 $creativeData = $creative
                   ->read(['object_story_spec', 'object_story_id'])
                   ->getData();

 // $creativeData['object_story_id'] contains an ID like 99999999999_99999999999,
 // $creativeData['object_story_spec'] is null

I tried to run query with curl, same result:

curl -G \
  -d 'fields=object_story_spec' \
  -d 'fields=object_story_id' \
  -d 'access_token=MYTOKEN' \
  https://graph.facebook.com/v2.6/123456789

The result does not contain object_story_spec at all:

{"object_story_id":"99999999999_99999999999","id":"123456789"}

A few more things:

  • The token is authorized to perform actions.
  • The ad is active.
  • object_story_spec is definitely a correct field since querying a non-existent field results in error

Best regards, Alexander

P.S. I submitted a bug report to FB: https://developers.facebook.com/bugs/1721287254755608/

Alexander Mikhalchenko
  • 4,525
  • 3
  • 32
  • 56
  • Did you create the linked object with object_story_spec or did you create it separately and link it to the adcreative? – bjeavons Jun 27 '16 at 14:06
  • @bjeavons the ad was created with facebook gui. I've loaded a whole bunch of adcreatives, and all of them have no `object_story_spec` field – Alexander Mikhalchenko Jun 27 '16 at 14:26
  • understood. I'm not certain but I suspect that the Facebook Ads Manager (and Power Editor too) don't use obejct_story_spec when creating Ad Creatives. They probably create a page post separately and then link with object_story_id. – bjeavons Jun 27 '16 at 15:30

1 Answers1

2

object_story_spec can be read back from an adcreative when it was used in the creation of that adcreative. If an object is created first it can be linked to an adcreative using object_story_id but that does not populate object_story_spec, the field will be NULL or not returned at all from Graph API.

object_story_spec is a helper method for creating objects (e.g. page posts) inline to creating a ad creative. See https://developers.facebook.com/docs/marketing-api/reference/ad-creative#Creating for more info on these fields and try out one of the example code snippets to see object_story_spec returned on a read request when it is used on the create request.

bjeavons
  • 1,123
  • 6
  • 16
  • Thank you for your response, but do you mean that I can not read `object_story_spec` for an existing AdCreative? (I'm not intending to create anything, just trying to get the link of an ad). – Alexander Mikhalchenko Jun 27 '16 at 15:42
  • You cannot read it if the adcreative was not made using it. What's your objective for reading object_story_spec? – bjeavons Jun 27 '16 at 15:54
  • quite a long story. We need to add a parameter to the url for tracking, `url_params` works quite OK but for some crooked type of ads that are somehow combined or whatever it's not possible to edit `url_params`. So I want to add stuff to the link itself, but first I need to read it. – Alexander Mikhalchenko Jun 27 '16 at 16:02
  • Make 2 requests (first to get the `object_story_id` and then use that to get the object's `link`) or else use batch request with dependencies https://developers.facebook.com/docs/graph-api/making-multiple-requests/ – bjeavons Jun 27 '16 at 18:19