Capture error "authorizationError":"ACTION_NOT_PERMITTED"

120 views
Skip to first unread message

cv

unread,
Aug 6, 2024, 9:17:07 AM8/6/24
to Google Ads API and AdWords API Forum
Hi,
I am trying to update campaign with Mutate Operation for IP Block.
I am getting error "authorizationError":"ACTION_NOT_PERMITTED".
I need to catch the error for same but did not find any documentaion to catch such error.

Please guide how I can catch such error.

Thanks,

Google Ads API Forum Advisor

unread,
Aug 6, 2024, 1:25:55 PM8/6/24
to chirag....@gmail.com, adwor...@googlegroups.com
Hi,

Could you let us know what programming language you are using? That way, we can show you how to use a try/catch block in that language.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vEcLy:ref" (ADR-00262184)

Thanks,
 
Google Logo
Benji Rothman
Google Ads API Team


cv

unread,
Aug 7, 2024, 12:57:52 AM8/7/24
to Google Ads API and AdWords API Forum
I am using PHP for this.

Google Ads API Forum Advisor

unread,
Aug 7, 2024, 12:07:12 PM8/7/24
to chirag....@gmail.com, adwor...@googlegroups.com
Hi,

Here is a `try/catch` example for UpdateCampaign.php from our client library on Github. You can use this syntax to catch any errors you may encounter when making requests against the Google Ads API.

cv

unread,
Aug 8, 2024, 3:14:28 AM8/8/24
to Google Ads API and AdWords API Forum
Hi,

I already had placed this check in place.
But this seems not capturing "authorizationError":"ACTION_NOT_PERMITTED"

My Example:
try {
           $CampaignCriterionServiceClient = $googleAdsClient->getCampaignCriterionServiceClient();
            $response = $CampaignCriterionServiceClient->mutateCampaignCriteria(
                    $customerId,
                    $operations,
                    ['partialFailure' => true, 'validateOnly' => false, 'responseContentType' => ResponseContentType::MUTABLE_RESOURCE]
                );
           
        } catch (GoogleAdsException $googleAdsException) {
            throw $googleAdsException;
        } catch (ApiException $apiException) {
            throw $apiException;
        }

Thanks,

Google Ads API Forum Advisor

unread,
Aug 9, 2024, 11:22:44 AM8/9/24
to chirag....@gmail.com, adwor...@googlegroups.com
Hi,

I believe the reason the code is not capturing "authorizationError":"ACTION_NOT_PERMITTED is because you are using 'partialFailure' => true. When that parameter is set to true, even if the request fails, our systems return a successful response, with the error message in the body of the response. See our guide on Partial Failures for a more detailed explanation, as well as a code sample for how to handle partial failure errors.

cv

unread,
Aug 14, 2024, 5:10:05 AM8/14/24
to Google Ads API and AdWords API Forum
Hello Benji,

Yes, I have added partial failure true so that script dont break and run continue and If any error I can capture.
But It simply break the process, so It is not the reason for not capturing the catch part.

Thanks,

Google Ads API Forum Advisor

unread,
Aug 14, 2024, 4:26:24 PM8/14/24
to chirag....@gmail.com, adwor...@googlegroups.com
Hi,

Could you please what you mean by "But It simply break the process, so It is not the reason for not capturing the catch part."

Can you walk me through a request that you're making with the code you provided, and where in the code an authorization error is occurring that is not being caught?

Note that in the example you provided us, even in the catch block, it says `throw $googleAdsException`, which would break the process, since you're throwing the error, not just logging it.
Reply all
Reply to author
Forward
0 new messages