Task: automatically collect data from Facebook advertising office.

There is an application (facebook app) with access to an advertising account ( access level = development ).

Added product 'Marketing API' to the application.

By app_id and secret key received access_token via

 GET https://graph.facebook.com/oauth/access_token?client_id=<app_id>&client_secret=<secret>7&grant_type=client_credentials 

of type app_id|token .

When trying to collect insights:

 GET https://graph.facebook.com/v2.8/act_<ad_account_id>/insights/?access_token=<access_token> 

I get

  "message": "Unsupported get request.", "type": "GraphMethodException", "code": 100 

If we specifically make mistakes in writing <ad_account_id> or <access_token> in response, I get the corresponding errors:

"The account is invalid"

"Invalid OAuth access token"

I obviously miss something, but I don’t understand what. I would appreciate any help, thanks in advance.

    1 answer 1

    Decided to create a user-token, instead of app-token.