Adding an Ad to a campaign with the Google Ads API

120 views
Skip to first unread message

AMD Google Registrations

unread,
Apr 12, 2023, 1:18:21 PM4/12/23
to Google Ads API and AdWords API Forum
Hi all,

When creating a campaign through the Google Ads Manager Dashboard, I can add an ad as it is seen in the attached screenshot. This ad among others can have headlines, descriptions and target URLs.

However, I cannot find how this is supported through the API, the only resource I have found that can be linked to a campaign is an adGroup but for this resource i cannot find a headline parameter.

Am I missing something or is this functionality not supported through the API ?

Adding Ad to a Campaign.png

Google Ads API Forum Advisor

unread,
Apr 12, 2023, 7:18:08 PM4/12/23
to adwor...@googlegroups.com

Hi,

Thank you for reaching out to Google Ads API Forum.

The fields highlighted in your screenshot can be set in an Ad resource. You may refer to this REST endpoint guide for mutating AdGroupAds. You may see the AdGroupAdOperation request body data and check the fields available.

Let me know how it goes.

Reference links included in this email:


Regards,

Google Logo Google Ads API Team


ref:_00D1U1174p._5004Q2kUdVV:ref

Google Ads API Forum Advisor

unread,
Apr 20, 2023, 1:56:21 PM4/20/23
to anal...@waymore.io, adwor...@googlegroups.com

Hi Symeon,

Thanks for getting back with us.

Thanks for letting us know that you were able to perform the operation. 

If you have any more questions related to Google Ads API feel free to contact us.

Links included in this email:

AMD Google Registrations

unread,
Apr 21, 2023, 7:48:51 AM4/21/23
to Google Ads API Forum Advisor, adwor...@googlegroups.com
Hi all,

I have posted another issue i have and i will copy it here for ease of reference, 

I am using the API to create an Ad Group Criterion. The object in my json payload is 

{
            "campaignCriterionOperation": {
                "create": {
                    "resourceName""customers/{{routeeClientId}}/campaignCriteria/-1~-2",
                    "displayName""Keyword Criterion PHRASE not negative- sms api",
                    "type""KEYWORD",
                    "status""ENABLED",
                    "negative"false,
                    "keyword": {
                        "matchType""PHRASE",
                        "text""sms api"
                    }
                }
            }
        }

I get

"error": {
        "code"400,
        "message""Invalid JSON payload received. Unknown name \"keyword\" at 'mutate_operations[3].ad_group_criterion_operation': Cannot find field.",
        "status""INVALID_ARGUMENT",
        "details": [
            {
                "@type""type.googleapis.com/google.rpc.BadRequest",
                "fieldViolations": [
                    {
                        "field""mutate_operations[3].ad_group_criterion_operation",
                        "description""Invalid JSON payload received. Unknown name \"keyword\" at 'mutate_operations[3].ad_group_criterion_operation': Cannot find field."
                    }
                ]
            }
        ]
    
What am i doing wrong ?

Many thanks in advance,

Kind regards
Symeon Foskolos

AMD Google Registrations

unread,
Apr 21, 2023, 12:19:53 PM4/21/23
to ads...@forumsupport.google, adwor...@googlegroups.com
Hi all,

I found the documentation very helpful and was able to perform the operation, many thanks for your support.

Kind regards
Symeon

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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 a topic in the Google Groups "Google Ads API and AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/toQG6LAxM8I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/NQStv000000000000000000000000000000000000000000000RT0O9N00fV-KqoDlTayUYIymEDwTaQ%40sfdc.net.

Google Ads API Forum Advisor

unread,
Apr 21, 2023, 12:53:57 PM4/21/23
to anal...@waymore.io, adwor...@googlegroups.com

Hello Symeon,

Thanks for getting back to us.

You may refer to this link for the Method: customers.adGroupCriteria. You may also use the request builder to build your request body(located at the right side of the page). You may also refer to this documentation for more information on Ad Group Criterion and its fields. 

If the error persists, can you please provide us with the complete request and response logs with request ID generated on your end so we can investigate further?

Links for reference:
Method: customers.adGroupCriteria https://developers.google.com/google-ads/api/rest/reference/rest/v13/customers.adGroupCriteria/mutate
Ad Group Criterion https://developers.google.com/google-ads/api/rest/reference/rest/v13/AdGroupCriterion
Request - https://developers.google.com/google-ads/api/docs/concepts/field-service#request
Response Logs - https://developers.google.com/google-ads/api/docs/concepts/field-service#response
Request ID - https://developers.google.com/google-ads/api/docs/concepts/call-structure#request-id

Regards,

Message has been deleted

Google Ads API Forum Advisor

unread,
Apr 26, 2023, 11:22:30 AM4/26/23
to anal...@waymore.io, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

For us to further investigate the issue, could you please provide these logs via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com. Please include the customer id in the logs.

In addition, I will also remove your recent post in this forum as it contains logs for security purposes.

Kind regards,
Reply all
Reply to author
Forward
0 new messages