We tried to add new ImageAds using by the GoogleAds API Ver 2.2.0.
We used the below code :
```
$imageAdInfo = new ImageAdInfo([
'data' => new BytesValue(['value' => file_get_contents($file)]),
]);
$ad = new Ad([
'image_ad' => $imageAdInfo,
'final_urls' => [
new StringValue(['value' => 'http://www.example.com/cruise/space/']),
new StringValue(['value' => 'http://www.example.com/locations/mars/'])
],
]);
// Creates an ad group ad to hold the above ad.
$adGroupAd = new AdGroupAd([
'ad_group' => new StringValue(
['value' => AdGroupServiceClient::adGroupName($this->customerId,
$adwordsAdgroupId)]
),
'status' => AdGroupAdStatus::PAUSED,
'ad' => $ad
]);
// Creates an ad group ad operation and add it to the operations array.
$adGroupAdOperation = new AdGroupAdOperation();
$adGroupAdOperation->setCreate($adGroupAd);
// Issues a mutate request to add the ad group ads.
$adGroupAdServiceClient = $this->googleAdsClient->getAdGroupAdServiceClient();
$response = $adGroupAdServiceClient->mutateAdGroupAds($this->customerId,
[$adGroupAdOperation]);
However, we got the following error message from API:
```
1. message: "{↵ "message": "Request contains an invalid argument.",↵
"code": 3,↵ "status": "INVALID_ARGUMENT",↵ "details": [↵ {↵ "@type":
"google.ads.googleads.v2.errors.googleadsfailure-bin",↵ "data": "<Unknown
Binary Data>"↵ },↵ {↵ "@type": "grpc-status-details-bin",↵ "data":
"<Unknown Binary Data>"↵ },↵ {↵ "@type": "request-id",↵ "data":
"GbrTnlpsh0jE6v_LuBkDPw"↵ }↵ ]↵}"
2. exception: "Google\Ads\GoogleAds\Lib\V2\GoogleAdsException"
3. file: "
/www/weddingpark.net/at-diamond-metal5/releases/20191202065757/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V2/GoogleAdsExceptionMiddleware.php
"
```
So, we want to know the required fields to add the new ImageAd.
However, we couldn't find the information about this.
Could you please tell us the required fields in the above case?
Best Regards.
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/26030758-eab6-446b-bbc9-82da92ef9933%40googlegroups.com.