Can't access Facebook campaigns

2019-07-06 21:19发布

问题:

I'm unable to get a list of my campaigns using Facebook Graph API

Response for /me/adaccounts

{
  "data": [
    {
      "account_id": "123456789000001234",
      "id": "act_123456789000001234"
    }
  ],
  "paging": {
    "cursors": {
      "before": "AAAAaaaBBBBcccc",
      "after": "AAAAaaaBBBBdddd"
    }
  }
}

/123456789000001234/campaigns returns

{
  "error": {
    "message": "Unsupported get request. Object with ID '123456789000001234' 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": "EilRrOk1CEb"
  }
}

Note that id's have been changed to dummy-values.

The token is for a system user and the ad account have been assigned to the user (role: admin). Token contains following scopes: read_page_mailboxes, rsvp_event, ads_management, ads_read, read_insights, manage_pages, publish_pages, pages_show_list, pages_manage_cta, pages_manage_instant_articles, business_management, publish_actions

What am I doing wrong?

回答1:

Had to use id: act_123456789000001234 instead of account_id: 123456789000001234 so the request becomes /act_123456789000001234/campaigns. Also had to create a Facebook App, add Marketing API and assign to that an Ad Account, then create a token via the app instead of creating a token from the Business Manager.