PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 26, 2022

[FIXED] Stuck on 'Ads API Access Level:development'

 February 26, 2022     facebook-graph-api, facebook-marketing-api, facebook-php-sdk     No comments   

Issue

I try to have an app that can pause/resume my adset (accounts owned by myself).

I get no error message(or anything) output when requesting this

$adset = new AdSet($adsetid);
$adset->campaign_status = AdSet::STATUS_ACTIVE;
try{
  $adset->updateSelf();
} catch (RequestException $e) {
    $response = json_decode($e->getResponse()->getBody(), true);
    var_dump($response);
}

But I see that the adset status did not change.

Now, I do see that the Marketing API, Settings section shows me that the API access Level is development and the app doesn't have Ads management standard access.

no standard access

When I check permissions at App review > Permissions and features it shows 'Standard access' and 'ready to use'. (however not 'Active')

permissions

And at the same time my request count and error rate in the past 30 days are acceptable. I don't understand what is missing to make it work. Can anyone help me out?

callcount and error rate


Solution

The code I have shown in my question was based on the code I copied from the Facebook marketing API documentation.

Strangely when I simulated my request using the Graph API Explorer and hit the "Get code" button it will suggest you a different code.

When I used that code instead of the code of the marketing API docs it did seem to work just as expected. This code worked as opposed to the code from the docs:

$adsetid = "YOUR ADSET ID";
$access_token = "YOUR ACCESS TOKEN";
try {
  $response = $fb->post(
    '/'.$adsetid,
    array (
      'fields' => 'status',
      'status' => 'ACTIVE'
    ),
    $access_token
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();


Answered By - Fredds
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing