TJ1S
TJ1S

Reputation: 528

Unable to fetch all information for an AdCreative in Facebook

I'd like to use the API to pull some information about my unpublished ads before they go live. I've created an AdSet in FB with one corresponding Ad in that will drive visitors to my website. Using the graph explorer, I can get information about the ad:

GET /<some_ad_id>?fields=name,creative
{
  "name": "test ad 1",
  "creative": {
    "id": "6032176243294"
  },
  "id": "some_ad_id"
}

Now, in the power editor and in the ad manager, I can see the ad creative (or what I assume is the creative). Since it will be driving visitors to my site, it has a title, url, thumbnail, etc. I can edit those as need be. So if I do a request with the creative id as obtained above, I get this:

GET 6032176243294?fields=object_type,thumbnail_url,object_url,name,title
{
 "object_type": "SHARE",
 "thumbnail_url": "https://biglongurl.com",
 "name": "Ad from a Page post #6,032,176,243,294",
 "id": "6032176243294"
}

The thumbnail url has the proper image that I used, but none of the other information such as title, destination url, etc. What exactly am I doing wrong here? Reading through the docs, I think I'm iterating through all of the correct nodes in the FB graph.

Upvotes: 2

Views: 1454

Answers (1)

TJ1S
TJ1S

Reputation: 528

I figured out how to get this information with respect to unpublished ads whose goal it is to drive visitors to your website (not sure about published ads / other types since I was only making website click ads)...what you need to do is change the GET request for fetching the ad creative to include object_story_id to look like so:

GET 6032176243294?fields=object_type,thumbnail_url,object_story_id
{
 "object_type": "SHARE",
 "thumbnail_url": "https://biglongurl.com",
 "id": "6032176243294"
 "object_story_id": "1234_5678"
}

Then, what you do is you make a request like so with object_story_id:

GET 1234_5678?fields=caption,title,link
{
  "link": "awyisser.com",
  "title": "a test title",
  "caption": "click this"
}

However, if you have an ad that is meant for website clicks but is NOT tied to a page (ads that only appear on the right hand column), then the first call will actually contain the link, title, etc. So the best bet is to modify the first call to ad creative to include "fields=link", check for its existence in the returned json object, and make the second call with object_story_id to get the remaining information.

Upvotes: 2

Related Questions