Facebook account API API access is incorrect on Facebook site

I am trying to create an application that helps manage different accounts for different clients (multiple businesses, so it has to handle multiple accounts). I'm going through the Ads API documentation for Account Groups and the examples don't work in the Chart API Explorer. Things like GET requests for

https://graph.facebook.com/v2.4/<AD_ACCOUNT_GROUP_ID>/users

(from Facebook documentation here ) the following errors are returned:

{
    "error": {
        "message": "(#275) Ad account cannot be determined for this request", 
        "type": "OAuthException", 
        "code": 275
    }
}

      

As far as I can tell, the documentation is wrong - I think it cannot distinguish between the account ID from the ad and the ad group ID (I know this template is also used for things like custom audience management, which is why I assume it thinks he should see the account id add). Is there a better guide to updating account group memberships via an API I can reference, or an endpoint I can replace with the official Facebook documentation?

+3


source to share


2 answers


First of all, please note that currently you can still use v2.3 graphical calls to Facebook, previous versions are deprecated by Facebook.

You will receive this error. If you try older versions of graphs:

{
   "error": {
      "message": "(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version.",
      "type": "OAuthException",
      "code": 2635
   }
}

      

At the time of this writing, you can use v2.3 calls and it still works.

Next, I'll assume you want to know all the users in the accounts, so the first thing to do is get a list of accounts ... Then go through each one based on the account.

Take a look at the api call to get a list of ad accounts, for the Facebook user id. You will need ad_read permission on the token to get the list.



Then your api call should look like this so that users can see them in each account. Note that I put act_ in front of the actual account id. This is necessary and tells Facebook that you are dealing with an account.

https://graph.facebook.com/v2.3/act_999998730499999/users?access_token=CAZZZZZpCZBjEBAJmcyfqbcluGAJZCtqfv4kI6CtLC7JGHaJ7IO2ImGCfkQFZC9NXCAZC2CAbtEdQcWMYFpqsFAkgJVqNqjnKGQkMrukyl53WZBIdq7vofFYyxvaTJTsWVOQhWTrjNoox0QqRCt3vGaDsRGHLBFDxqKLfXOcDKfS1oppj1nDjKdPe2GHYrHirlBkhxWS95MNgW7ajZZZZZ

Note. I have added ZZZZZ and 9999s to locations to mask my actual account and token.

The token used must be the account holder token for the application. The user must authorize the app for ad_read permission to create this token for the call to work.

The result looks like this:

{
   "data": [
      {
         "name": "Joe Programmer",
         "permissions": [
            1,
            2,
            3,
            4,
            5,
            7
         ],
         "role": 1001,
         "id": "999995304499999"
      }
   ]
}

      

+2


source


When using Facebook Ads Development Access, you must specify which advertisements you intend to use and you must own the advertisements.



See the following tutorial: https://developers.facebook.com/docs/reference/ads-api/access#standard_accounts

+1


source







All Articles