Required fields to add the new ImageAds.

110 views
Skip to first unread message

T.Motodate

unread,
Nov 7, 2019, 2:13:04 AM11/7/19
to AdWords API and Google Ads API Forum
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($image)]),
]);

$ad = new Ad([
    'image_ad'   => $imageAdInfo,
    'final_urls' => [
        new StringValue(['value' => $urlFinal]),
    ],
]);

$adGroupAd = new AdGroupAd([
    'ad_group' => $adGroupResourceName,
    'status'   => AdGroupAdStatus::ENABLED,
    'ad'       => $ad,
]);

$operationAdd = new AdGroupAdOperation();
$operationAdd->setCreate($adGroupAd);
$operations[] = $operationAdd;


$adGroupAdService->mutateAdGroupAds(GOOGLE_ADS_CUSTOMER_ID, $operations);
```

However, we got the following error message from API:
```
google-ads.WARNING: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v2.services.AdGroupAdService/MutateAdGroupAds", ClientCustomerId: XXXXXXX, RequestId: "XXXXXXXX", IsFault: 1, FaultMessage: "["The required field was not present.","A required field was not specified or is an empty string."]"
```

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.

T.Motodate

unread,
Nov 13, 2019, 7:10:41 PM11/13/19
to AdWords API and Google Ads API Forum
Could any one please tell me this specification?

Best Regards.

2019年11月7日木曜日 16時13分04秒 UTC+9 T.Motodate:

Google Ads API Forum Advisor Prod

unread,
Nov 14, 2019, 10:00:27 AM11/14/19
to motodate...@gmail.com, adwor...@googlegroups.com

Hi,

 

Thank you for reaching out. It looks like your post came in twice but the other one got deleted which caused the delay. Can you please provide the complete request and response logs via reply privately to author so that I can investigate the issue further? Please see here for information on how to enable logging.

 

Regards,

Mitchell

Google Ads API Team



ref:_00D1U1174p._5001UMWWmU:ref

T.Motodate

unread,
Nov 17, 2019, 11:46:32 PM11/17/19
to AdWords API and Google Ads API Forum
Thank you for your nice answer!

According to your advice, we got the complete log from the Google Ads API.
Then, the log indicates the information related to required fields.
So, we could realize the correct codes!

Now we can add new Image Ads via the API!

2019年11月15日金曜日 0時00分27秒 UTC+9 adsapiforumadvisor:
Reply all
Reply to author
Forward
0 new messages