Re: getting error while creating video campaign in google ads api

2023-04-18 Thread Ashish Chaturvedi (Ashu)


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!


On Tuesday, 18 April 2023 at 17:06:21 UTC+5:30 Google Ads API Forum Advisor 
wrote:

> 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, 
> [image: Google Logo] Google Ads API Team 
>
> ref:_00D1U1174p._5004Q2knXap:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/cf759341-5628-4a97-8e29-312533444696n%40googlegroups.com.


Getting Error While creating Video Campaign in Google Ads API

2023-04-18 Thread Ashish Chaturvedi (Ashu)


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