"ACTION_NOT_PERMITTED" }, "message": "The user does not have permission to perform this action on the resource or call a method."

518 views
Skip to first unread message

Charls

unread,
Apr 13, 2022, 3:57:40 AM4/13/22
to Google Ads Scripts Forum
Hi support team,

I'm trying to activate/pause an ad group with the code listed below, but I'm getting the following errors:

====================ERRORS====================

SystemError: Could not read from Google Ads (Internal details: Error in mutate response: [ { "errorCode": { "authorizationError": "ACTION_NOT_PERMITTED" }, "message": "The user does not have permission to perform this action on the resource or call a method." }, { "errorCode": { "authorizationError": "ACTION_NOT_PERMITTED" }, "message": "The user does not have permission to perform this action on the resource or call a method.", "location": { "fieldPathElements": [ { "fieldName": "mutate_operations", "index": 0 }, { "fieldName": "ad_group_operation" } ] } } ]) at g (adsapp_compiled:273:50) at Qc (adsapp_compiled:828:15) at Rc (adsapp_compiled:831:3) at wH.mutate (adsapp_compiled:18544:16) at eH (adsapp_compiled:18077:17) at fH.flush (adsapp_compiled:18159:71) at gH.flush (adsapp_compiled:18227:13) at gH.search (adsapp_compiled:18206:10) at nH.search (adsapp_compiled:18299:19) at kd (adsapp_compiled:1055:32)


====================CODE====================

function switchAdGroupStatus(adGroupName, activate) {
  var selectors = [
    AdsApp.adGroups(),
    AdsApp.videoAdGroups(),
    AdsApp.shoppingAdGroups()
  ];
  for(var i = 0; i < selectors.length; i++) {
    var adGroupIter = selectors[i]
        .withCondition('Name = "' + adGroupName + '"')
        .get();
   
    if (adGroupIter.hasNext()) {
      var currentAdGroup = adGroupIter.next();
      if (activate) {
        currentAdGroup.enable();
      } else {
        currentAdGroup.pause();
      }
    }
  }
}

Google Ads Scripts Forum Advisor

unread,
Apr 13, 2022, 6:03:48 AM4/13/22
to adwords...@googlegroups.com
Hello,

Thank you for reaching out to us.

With regard to your concern, the ACTION_NOT_PERMITTED usually occurs when the account who authorized the script didn't have permission (write) to the said Ads Account. That said, we would recommend to review the account who authorize the script and make sure that it has necessary permission.

Regards,
Google Logo
Teejay Wennie
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2a2kiD:ref
Reply all
Reply to author
Forward
0 new messages