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

How to get promoted page posts using FB api


I am able to get all the page posts that can be promoted via the endpoint given at https://developers.facebook.com/docs/marketing-api/campaigns/objectives#connection_objects

eg query:

https://graph.facebook.com/v2.5/[PAGE-ID]/promotable_posts?fields=id&is_published=true&access_token=[TOKEN]

but how do I get all the posts that are already promoted? I am unable to find anything on the FB API docs.


Solution

  • There is no simple way to do this as there is no association between a post and an ad.

    The easiest way to do this would likely be to request all creatives for an account, along with their object_story_id:

    /<VERSION>/act_<ACCOUNT_ID>/adcreatives?fields=object_story_id
    

    And then request all ads within the account along with creative and reference whether there is a match:

    /<VERSION>/act_<ACCOUNT_ID>/ads?fields=id,creative