Hi Daniel,
Thanks for the reply.

I am trying to create Ad using REST API, and I receive error that create 
operation is not supported. How I can create Ad using rest API? Or I should 
create Ad with Google UI, select Ad and update it via rest API? What if 
there is new campaign without AdGroup and Ads? 

My request was:
url = 'https://googleads.googleapis.com/v11/customers/XXXX/ads:mutate'
params = {
"operations": [{
"create": {
"finalUrls": ["devel.odore.com", "link.to.campaign.org"],
"type": "RESPONSIVE_SEARCH_AD",
"name": "My Ad 12345",
"responsiveSearchAd": {
"headlines": [{
"pinnedField": "HEADLINE_1",
"text": "Get Free Sample"
},
{
"pinnedField": "HEADLINE_2",
"text": "Get your free sample"
},
{
"pinnedField": "HEADLINE_3",
"text": "Get free sample from us"
},
{
"pinnedField": "DESCRIPTION_1",
"text": "Please fill in the questionnaire and you'll get free sample"
},
{
"pinnedField": "DESCRIPTION_2",
"text": "Please reply to questions and get your free sample"
}]
}

}
}]
}

And response is:
Status 400
Data {
    "error": {
        "code": 400,
        "message": "Invalid JSON payload received. Unknown name \"create\" 
at 'operations[0]': Cannot find field.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": "type.googleapis.com/google.rpc.BadRequest",
                "fieldViolations": [
                    {
                        "field": "operations[0]",
                        "description": "Invalid JSON payload received. 
Unknown name \"create\" at 'operations[0]': Cannot find field."
                    }
                ]
            }
        ]
    }
}

Could you please help me with this? 
On Wednesday, November 2, 2022 at 7:47:55 PM UTC+2 adsapi wrote:

> Hi Anna,
>
> With regard to your questions, please see the below items:
>
> *How can we create Ad (not from google UI, but from API)?*
>
> You are able to create Ads from the API using the customer.Ad 
> <https://developers.google.com/google-ads/api/rest/reference/rest/v12/customers.ads#Ad>
>  object.
>
> *About the other questions:*
>
> To add an Ad to a campaign first you need to create an AdGroup 
> <https://developers.google.com/google-ads/api/rest/reference/rest/v12/AdGroup>
>  and 
> add the Ads to the Group using an AdGroupAd 
> <https://developers.google.com/google-ads/api/rest/reference/rest/v12/AdGroupAdOperation>
>  
> operation.
> An AdGroup 
> <https://developers.google.com/google-ads/api/rest/reference/rest/v12/AdGroup>
>  
> can be linked to a campaign using its "campaign" field.
>
> To link a LeadFormAsset 
> <https://developers.google.com/google-ads/api/rest/reference/rest/v12/Asset#LeadFormAsset>
>  to 
> a Campaign you would use the CampaignAsset 
> <https://developers.google.com/google-ads/api/rest/reference/rest/v12/CampaignAsset>
> .
>
> Finally, I know you are using the REST API and everything can be done 
> using the REST API with the links i sent you but I would suggest to use one 
> of 
> our client libraries 
> <https://developers.google.com/google-ads/api/docs/client-libs> as they 
> make this a lot easier and we have multiple examples. For example, see this 
> one on Python about creating a LeadForm 
> <https://developers.google.com/google-ads/api/docs/samples/add-lead-form-extension>.
>  
> Regardless if you decide to use a client library or not those  examples are 
> a great resource to find the resource names in the documentation.
>
> Regards,
>
> [image: Google Logo] 
> Daniel 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2fqO3b: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/3b6092e6-24ab-489a-a464-a7f889211cdan%40googlegroups.com.
  • RE... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
    • ... Anna Lysak
      • ... Anna Lysak
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to