Rubén
Rubén

Reputation: 105

Google Adsense Management API: servingLimitExceeded with a few queries

We are receiving a servingLmitExceeded after making a few queries to the Adsense Management API for obtaining daily info about each app. We are connecting to 5 accounts.

What we do is first obtain a list of the apps of each account running a report of the last 30d:

$start_date = 'today-30d';
$end_date = 'today-1d';

$options = array(
    'metric' => array('EARNINGS'),
    'dimension' => array('APP_ID','APP_NAME'),
);

Then, for each app (like 36 in total divided in all the accounts) we run the following report:

$start_date = $today->format("Y-m-d");
$end_date = $today->format("Y-m-d");

$options = array(
    'metric' => array('EARNINGS','AD_REQUESTS','AD_REQUESTS_COVERAGE','AD_REQUESTS_CTR','AD_REQUESTS_RPM','CLICKS','COST_PER_CLICK'),
    'dimension' => array('APP_ID','COUNTRY_CODE'),
    'filter' => array('APP_ID=@'.$app),
    'sort' => '+APP_ID'
);

After a few apps, we receive the following error:

{
    "error": {
        "errors": [
            { 
                "domain": "usageLimits",
                "reason": "servingLimitExceeded",
                "message": "Serving Limit Exceeded"
            }
        ],
        "code": 403,
        "message": "Serving Limit Exceeded"
    }
}

We think that we aren't hiting any of the limits that appear here: https://developers.google.com/adsense/management/appendix/limits

We are doing less than 50 requests in total per day and our limits now are 100 queries per 100 second per user:

enter image description here

If we check the Google APIs console, it appears that the errors are being thrown by adsense.accounts.list

enter image description here

Does anybody knows how to avoid this problem?

Upvotes: 0

Views: 187

Answers (1)

freddygv
freddygv

Reputation: 9638

A simple retry policy for the API call has worked for us.

It'll often go through if we retry 2-3 times with a 30s wait.

Upvotes: 1

Related Questions