OPERATION_NOT_PERMITTED_FOR_CONTEXT

131 views
Skip to first unread message

Gomathi Gunasekaran

unread,
Mar 14, 2024, 1:44:06 AM3/14/24
to Google Ads API and AdWords API Forum
Regarding the budget creation issue, I'm encountering difficulties in creating budgets. while this functionality worked good in the previous version, I've encountered unexpected behaviour upon transitioning to v16

{
  "mutateOperations": [
    {
      "campaignBudgetOperation": {
        "create": {
          "amountMicros": 10000,
          "resourceName": "customers/{customer id}/campaignBudgets/-21"
        }
      }
    }
  ]
}

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure",
        "errors": [
          {
            "errorCode": {
              "contextError": "OPERATION_NOT_PERMITTED_FOR_CONTEXT"
            },
            "message": "The operation is not allowed for the given context.",
            "location": {
              "fieldPathElements": [
                {
                  "fieldName": "mutate_operations",
                  "index": 0
                },
                {
                  "fieldName": "campaign_budget_operation"
                }
              ]
            }
          }
        ],
        "requestId": "PZICEDkPZmRLdds_vTqLpZ9Zg"
      }
    ]
  }
}

Google Ads API Forum Advisor

unread,
Mar 14, 2024, 5:13:12 AM3/14/24
to gomathiguna...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

By reviewing your query, I understand that you are getting the 'OPERATION_NOT_PERMITTED_FOR_CONTEXT' error when trying to create a campaign budget using the v16. Kindly note that no resource name is expected for the new budget when performing the create operation. Kindly check the below sample request :
{
  "operations": [
    {
      "create": {
        "name": "Campaign Budget Test 5",
        "amountMicros": 10000
      }
    }
  ],
  "partialFailure": true
}

I have tried to replicate the issue on my end and I did not encounter the error "OPERATION_NOT_PERMITTED_FOR_CONTEXT". I am getting a successful run using v16 on the above request and the results are returned. I would suggest you try making a new request to the customers.campaignBudgets.mutate endpoint using the above sample and let us know how this goes on your end.

This message is in relation to case "ref:!00D1U01174p.!5004Q02rzwWh:ref" (ADR-00227225)

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages