Getting Error While creating Video Campaign in Google Ads API

140 views
Skip to first unread message

Ashish Chaturvedi (Ashu)

unread,
Apr 18, 2023, 4:09:13 AM4/18/23
to Google Ads API and AdWords API Forum

Hello,

I'm trying to create a video campaign using the Google Ads API, based on the documentation for Campaigns in version 13: https://developers.google.com/google-ads/api/reference/rpc/v13/Campaign. I'm also referencing the video channel type documentation here: https://developers.google.com/google-ads/api/reference/rpc/v13/AdvertisingChannelTypeEnum.AdvertisingChannelType.

However, when I try to create my campaign, I'm encountering an error.

{
    "message": "Request contains an invalid argument.",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": [
        {
            "@type": "type.googleapis.com\/google.ads.googleads.v13.errors.GoogleAdsFailure",
            "errors": [
                {
                    "errorCode": {
                        "mutateError": "MUTATE_NOT_ALLOWED"
                    },
                    "message": "Mutates are not allowed for the requested resource.",
                    "trigger": {
                        "stringValue": "VIDEO"
                    },
                    "location": {
                        "fieldPathElements": [
                            {
                                "fieldName": "operations",
                                "index": 0
                            }
                        ]
                    }
                },
                {
                    "errorCode": {
                        "contextError": "OPERATION_NOT_PERMITTED_FOR_CONTEXT"
                    },
                    "message": "The operation is not allowed for the given context.",
                    "trigger": {
                        "stringValue": "MANUAL_CPC"
                    },
                    "location": {
                        "fieldPathElements": [
                            {
                                "fieldName": "operations",
                                "index": 0
                            },
                            {
                                "fieldName": "create"
                            },
                            {
                                "fieldName": "manual_cpc"
                            }
                        ]
                    }
                }
            ],
            "requestId": "vyH2QzTeEcbk6SNicNHJrA"
        }
    ]
}

My Code is

try {
// Creates a single shared budget to be used by the campaigns added below.
$budgetResourceName = $this->addCampaignBudget($customerId, $refreshToken);
$budgetResourceName = json_decode($budgetResourceName->getContent(),true);
// Configures the campaign network options.
$networkSettings = new NetworkSettings([
'target_google_search' => true,
'target_search_network' => true,
'target_content_network' => true,
'target_partner_search_network' => true
]);
$campaignOperations = [];
$params['name'] = 'VIDEO Campaign';
$params['advertising_channel_type'] = AdvertisingChannelType::VIDEO;
$params['manual_cpc'] = new ManualCpc();
$params['campaign_budget'] = $budgetResourceName['response'];
$params['network_settings'] = $networkSettings;
$params['start_date'] = date('Ymd', strtotime('+1 day'));
$params['end_date'] = date('Ymd', strtotime('+1 month'));
$campaign = new Campaign($params);
// Creates a campaign operation.
$campaignOperation = new CampaignOperation();
$campaignOperation->setCreate($campaign);
$campaignOperations[] = $campaignOperation;

// Issues a mutate request to add campaigns.
$googleAdsClient = $this->googleAdsClient($refreshToken);
$campaignServiceClient = $googleAdsClient->getCampaignServiceClient();
$response = $campaignServiceClient->mutateCampaigns($customerId, $campaignOperations);
foreach ($response->getResults() as $addedCampaign) {
$addedCampaignResult = $addedCampaign->getResourceName();
}
$resultResponse = [];
if($addedCampaignResult) {
$resultResponse['name'] = $addedCampaignResult;

$resultResponse['status'] = CampaignStatus::PAUSED;
preg_match('/customers\/(\d+)/', $addedCampaignResult, $matches);
$resultResponse['customerId'] = $matches[1];

// Extract campaign ID
preg_match('/campaigns\/(\d+)/', $addedCampaignResult, $matches);
$resultResponse['campaignId'] = $matches[1];
$resultResponse['id'] = $matches[1];
}
return response()->json(['status' => 1, 'response' => $resultResponse]);
} catch (ApiException $apiException) {
return response()->json(['status' => 0, 'error' => $apiException->getMessage(), 'errorMessage' => $apiException->getMessage(), 'error_type' => 'campaign', 'response' => null]);
}

  • I would like to confirm whether video campaigns are supported in the Google Ads API or not.

  • Is the video campaign feature still in beta version of Google Ads API? Could this be the reason why I am getting the error "A mutate action is not allowed on this resource, from this client"?

  • If the video campaign feature is in beta, how can I request access to the beta version?

  • I noticed that I only have basic API access. If I request standard API access, would it enable me to create video campaigns or not?

Thanks,
Ashish

Google Ads API Forum Advisor

unread,
Apr 18, 2023, 7:36:21 AM4/18/23
to ashish007...@gmail.com, adwor...@googlegroups.com
Hi Ashish,

Thank you for reaching out to the Google Ads API support team. I hope that you are doing well today.

I understand that your concern is about creating Video campaigns via API. Note that this is not possible as it is documented here in this link (https://developers.google.com/google-ads/api/docs/campaigns/overview#differences_from_the_google_ads_ui) "Not all campaign types in the Google Ads UI are supported in the API, such as Video Campaigns. Video campaign metrics are available for retrieval in the API. However, video campaigns cannot be mutated at all from the API, including simple operations such as pausing or enabling as well as complex operations like organizing, changing criteria, or adding ad groups."

In addition, there is no Beta version of this campaign and even if you upgrade your Developer Token Access from Basic to Standard, it will not enable you to create Video campaigns via API.

I hope this clears out your concern.

Kind regards,
Google Logo Google Ads API Team


ref:_00D1U1174p._5004Q2knXap:ref

Ashish Chaturvedi (Ashu)

unread,
Apr 18, 2023, 10:18:50 AM4/18/23
to Google Ads API and AdWords API Forum

Hello!

Thank you for your quick reply. I would like to confirm if it is possible to create a Responsive Display Ad ('advertising_channel_type' => AdvertisingChannelType::DISPLAY) using the Google Ads API.

If yes, I would also like to know the limitations on the Responsive Display Ad that can be created using the Google Ads API.

It would be great if you could provide me with this information.

Thank you!

Google Ads API Forum Advisor

unread,
Apr 18, 2023, 3:53:43 PM4/18/23
to ashish007...@gmail.com, adwor...@googlegroups.com

Hi,

Thanks for getting back to us.

Upon checking this guide (https://developers.google.com/google-ads/api/docs/ads/ad-types#ad_type_compatibility) Responsive Display Ad is mutable in Google Ads API. 

You may refer to this guide (https://developers.google.com/google-ads/api/docs/responsive-display-ads/overview) about Responsive Display Ads overview and this guide (https://developers.google.com/google-ads/api/docs/responsive-display-ads/create-responsive-display-ads) about Creating Responsive Display Ads together with its ad creation specifications.

Let me know if you have further questions related to Google Ads API.

Regards,

Reply all
Reply to author
Forward
0 new messages