About create / update Ads via API.

56 views
Skip to first unread message

T.Motodate

unread,
Oct 12, 2016, 10:31:41 PM10/12/16
to AdWords API Forum
I have some questions about create / update Ads via AdWords API.

1) About create banner ad.

I referred the Samples page and found the section "Add expanded text ad".
I recognized that we can create text ads according to this section.

However, I couldn't found any sections about adding Banner Ads.
Could you please tell me how to realize it?

2) About update ads.

I also couldn't found any section about updating Ads.

According to the Adwords Manager Site, updating Ads means that "remove old ad and create new ad".
Therefore, I guess that we need the below way to realize updating Ads via API:
1.Remove the target ad via API.
2.Create the target ad via API.

Could you please tell me whether it's right.

=====

Best Regards

Joyce Lava

unread,
Oct 13, 2016, 2:29:44 AM10/13/16
to AdWords API Forum
Hello,

Please see below my answers to the questions:

1) About create banner ad.

There is no example code available that shows how to create banner ad. However, you may use the AddExpandedTextAds.java (Java client library example code) as a reference to create an ImageAd or use any Template Ads available in the API. Please follow these steps to help you get started:
 
a. create the ImageAd object; required fields can be seen in the doc.
b. create the Image object. Please consider the image requirements when creating the Image object. Set this image to the ImageAd created in step a. 
c. set the ImageAd as the ad of the AdGroupAd, then do the AdGroupAdService.mutate operation.
 
The AddHtml5Ad.java (Java client library example code) can also be used as a reference when dealing with creation of TemplateAds. Available Template Ads are provided in the link above. Other client libraries example codes are available here.

2) About update ads.

The only field that you can update in an ad is the status field as discussed here. There is no available example code that shows how to update the adGroupAdStatus but you may refer to the below SOAP logs to see how it is being done. 
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201609" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>YOUR_CLIENT_CUSTOMER_ID</ns1:clientCustomerId>
            <ns1:developerToken>YOUR_DEVELOPER_TOKEN</ns1:developerToken>
            <ns1:userAgent>YOUR_USER_AGENT</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201609">
            <operations>
                <operator>SET</operator>
                <operand>
                    <adGroupId>YOUR_ADGROUP_ID</adGroupId>
                    <ad>
                        <id>YOUR_AD_ID</id>
                    </ad>
                    <status>PAUSED</status>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

Additionally, If you need to update any other fields, then yes, you need to remove the existing ad and create a new one.

Hope this helps.

Best,
Joyce, AdWords API Team 

T.Motodate

unread,
Oct 13, 2016, 8:09:10 PM10/13/16
to AdWords API Forum
Thank you very much for your answer, Joyce!

About Question1:
I'll try to create according to your answer.

About Question2:
Got it.
The way that removing old ads and creating new ads can realize our requirements.

Joyce Lava

unread,
Oct 13, 2016, 10:11:56 PM10/13/16
to AdWords API Forum
Hello,

Glad to hear that I was able to help. Just to add, for second concern, I recommend adding the new ad first before deleting the old one just to make sure that the new ad will be available already before the old one gets removed from the adGroup.

Thanks,
Joyce, AdWords API Team

T.Motodate

unread,
Oct 14, 2016, 12:04:24 AM10/14/16
to AdWords API Forum
Thanks a lot for your kindness, Joyce!

2016年10月14日金曜日 11時11分56秒 UTC+9 Joyce Lava:
Reply all
Reply to author
Forward
0 new messages