Creating Smart Campaign - errors = OPERATION_NOT_PERMITTED_FOR_CONTEXT and RESOURCE_NOT_IN_GOOGLE_ADS

100 views
Skip to first unread message

Darshan Dhabale

unread,
Jul 23, 2024, 7:05:51 PM7/23/24
to Google Ads API and AdWords API Forum
I am able to create DEMAND_GEN type campaigns with the same request but not this one.

Here is the curl of the request I am trying to run, followed by the api response -
curl --location 'https://googleads.googleapis.com/v17/customers/{{CUSTOMER_ID}}/campaigns:mutate' \
--header 'developer-token: {{DEVELOPER_TOKEN}}' \
--header 'login-customer-id: {{LOGIN_CUSTOMER_ID}} \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{TOKEN}}' \
--data '{
    "operations": [
        {
            "create": {
                "name": "A smart campaign",
                "status": "PAUSED",
                "campaignBudget": "customers/{{CUSTOMER_ID}}/campaignBudgets/{{BUDGET_ID}}",
                "advertisingChannelType": "SMART",
                "advertisingChannelSubType": "SMART_CAMPAIGN",
                "targetCpa": {
                    "targetCpaMicros": 5000000
                }
            }
        }
    ]
}
'

Here is the response from the api -
{
    "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": "type.googleapis.com/google.ads.googleads.v17.errors.GoogleAdsFailure",
                "errors": [
                    {
                        "errorCode": {
                            "contextError": "OPERATION_NOT_PERMITTED_FOR_CONTEXT"
                        },
                        "message": "The operation is not allowed for the given context.",
                        "location": {
                            "fieldPathElements": [
                                {
                                    "fieldName": "operations",
                                    "index": 0
                                },
                                {
                                    "fieldName": "create"
                                },
                                {
                                    "fieldName": "target_cpa"
                                }
                            ]
                        }
                    },
                    {
                        "errorCode": {
                            "mutateError": "RESOURCE_NOT_IN_GOOGLE_ADS"
                        },
                        "message": "The resource isn't in Google Ads. It belongs to another ads system.",
                        "trigger": {
                            "int64Value": "13772297422"
                        },
                        "location": {
                            "fieldPathElements": [
                                {
                                    "fieldName": "operations",
                                    "index": 0
                                },
                                {
                                    "fieldName": "create"
                                },
                                {
                                    "fieldName": "campaign_budget"
                                }
                            ]
                        }
                    }
                ],
                "requestId": "MlaH1pp2485Ww4E768Do0g"
            }
        ]
    }
}

Thanks for your help

Google Ads API Forum Advisor

unread,
Jul 24, 2024, 8:01:52 AM7/24/24
to dhabale...@gmail.com, adwor...@googlegroups.com
Hi,

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

Based on the provided information, it is observed that you've encountered the "OPERATION_NOT_PERMITTED_FOR_CONTEXT" and "RESOURCE_NOT_IN_GOOGLE_ADS" errors while creating smart campaign. 

I could see that you've redacted information like CUSTOMER_ID, LOGIN_CUSTOMER_ID and BUDGET_ID. Please share these details to investigate why you're encountering those errors'.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vE4SX:ref" (ADR-00259272)

Thanks,
 
Google Logo Google Ads API Team


Darshan Dhabale

unread,
Jul 25, 2024, 9:39:08 AM7/25/24
to Google Ads API and AdWords API Forum

curl --location 'https://googleads.googleapis.com/v17/customers/4926841893/campaigns:mutate' \
--header 'developer-token: DEVELOPER_TOKEN' \
--header 'login-customer-id: 3263459376' \

--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--data '{
    "operations": [
        {
            "create": {
                "name": "A smart campaign",
                "status": "PAUSED",
                "campaignBudget": "customers/4926841893/campaignBudgets/13772297422",

                "advertisingChannelType": "SMART",
                "advertisingChannelSubType": "SMART_CAMPAIGN",
                "targetCpa": {
                    "targetCpaMicros": 5000000
                }
            }
        }
    ]
}
'

Here is the curl with the requested information.


and here is the response from the api
                "requestId": "yw-3eGhyoyzPhUEvNzB2Hw"
            }
        ]

Google Ads API Forum Advisor

unread,
Jul 25, 2024, 1:33:20 PM7/25/24
to dhabale...@gmail.com, adwor...@googlegroups.com
Hi,

Upon checking, I could see that the campaign budget '13772297422' is 'Standard' type. Please note that the campaign budget type must be set to 'SMART_CAMPAIGN'. Please refer to this guide to create a budget for smart campaigns and refer to this guide to know more about smart campaigns.

Hope this helps. If you have any more queries, please feel free to get back to us.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vE4SX:ref" (ADR-00259272)

Thanks,

 
Google Logo Google Ads API Team

Register for the upcoming workshop: Performance Max and the Google Ads API!
 


Darshan Dhabale

unread,
Jul 25, 2024, 8:06:48 PM7/25/24
to Google Ads API and AdWords API Forum
Thanks for the instructions. I was able to create a smart campaign with a smart_campaign type budget.

Google Ads API Forum Advisor

unread,
Jul 26, 2024, 3:50:58 AM7/26/24
to dhabale...@gmail.com, adwor...@googlegroups.com
Hi,

It's great to hear that you are able to create a smart campaign with a smart_campaign type budget. Kindly get back to us if you have any further queries related to the Google Ads API.

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

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages