skip to Main Content

I am trying to get the campaigns list from the Graph API Explorer. I’m using the request found at https://developers.facebook.com/docs/marketing-api/reference/ad-account/campaigns/.

GET /v2.8/{ad-account-id}/campaigns HTTP/1.1
Host: graph.facebook.com

I’m’ business manager and admin of the page used for ads. I found the AD_ACCOUNT_IDs using the following request on the Graph API Explorer.

GET /v2.8/me/businesses HTTP/1.1
Host: graph.facebook.com

I choosed the one which had the higher privileges.

The error reported when submitting the first request for campaigns is:

{
    "error": {
        "message": "Unsupported get request. Object with ID '1015359838XXXXXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
        "type": "GraphMethodException",
        "code": 100,
        "fbtrace_id": "DLyfwGbM8fi"
    }
}

What’s wrong?

Thanks in advance,

Mattia

2

Answers


  1. I similarly was having problems trying to retrieve a list of all campaign IDs within an ad account.

    I already am able to retrieve campaign data by ID, so I obviously have permissions already.

    But the Facebook error message is misleading.

    When retrieving an ad account (in order to then display its campaigns or whatever you want within it), you need to retrieve by its ID prepended with ‘act_’.

    E.g you could request /act_123456789000001234/campaigns instead of /123456789000001234/campaigns.

    Thanks so much to @Jan Sommer at https://stackoverflow.com/a/39974857/470749.

    Login or Signup to reply.
  2. @Ryan’s answer saved my day. It may sound stupid/silly but I was doing this mistake and I was just stuck at it.

    Going through the FB docs for using the Marketing Apis.

    I was trying to build the custom audience, this is how the curl request looks like –

    enter image description here

    One of the basic things to keep in mind while using the Marketing API is, almost all the APIs ask for these two things –
    1) ACCESS_TOKEN
    2) AD_ACCOUNT_ID

    For people who are just starting with the FB Marketing API or somehow stuck in finding these values, I will just tell you how to get these values, so that you don’t have to waste your time as I did.

    So for getting the ACCESS_TOKEN, go to your app dashboard then click Add Product and then select Marketing API. Once you added the product, this is how the screen should look like –

    enter image description here

    Now just check the permissions and click on the Get Token button, a token would be generated. Just copy the token in some file and save it.

    Now for getting the AD_ACCOUNT_ID value, just go to the Adverts Manager page –
    enter image description here

    The number that is written inside the red box in you Adverts Manager page is your AD_ACCOUNT_ID.

    The final step would be to go back to you app dashboard again, Settings > Advanced
    enter image description here

    Click on Ads API and then enter the AD_ACCOUNT_ID here. Thats it, you have finished the Access and Authentication process for using the marketing API via your App.

    Now comes the part where I was doing the silly mistake. The curls request looks like this –

    curl 
      -F 'name=My new CA' 
      -F 'subtype=CUSTOM' 
      -F 'description=People who bought from my website' 
      -F 'access_token=<ACCESS_TOKEN>' 
      https://graph.facebook.com/v2.8/act_<AD_ACCOUNT_ID>/customaudiences
    

    First I replaced ACCESS_TOKEN with its value.
    Then instead of replacing only the <AD_ACCOUNT_ID> I replaced the whole string act_<AD_ACCOUNT_ID>, with the AD_ACCOUNT_ID value.

    So I was getting this error while making request to the API which was –

    {"error":{"message":"Unsupported post request. Object with ID '120574219' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api","type":"GraphMethodException","code":100,"fbtrace_id":"YsSvKKwgLMQ"}}
    

    I don’t know why I made this mistake but I am sure this is one of the common mistake others are doing too. Since the response from FB was misleading, I wasted a lot of my time in understanding and reading on the API permissions and authentications.

    Hope this article was helpful and save your time.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search