What is the URL to mutate ad groups and ads?

185 views
Skip to first unread message

Steve Wilcox

unread,
Nov 19, 2020, 4:41:18 PM11/19/20
to AdWords API and Google Ads API Forum
Greetings Forum Faithful!

To create a campaign via the Ads Rest interface, you send a mutate request to:

/.../customers/CUSTOMER_ID/campaigns:mutate  

Once I have my campaign created, where do I send requests to create an ad group in that campaign?  

Once I have an ad group, where do I send requests to create an ad in that ad group?

Thanks!
Message has been deleted

Steve Wilcox

unread,
Nov 19, 2020, 5:23:27 PM11/19/20
to AdWords API and Google Ads API Forum
/customers/CUSTOMER_ID/adGroupAds:mutate
/customers/CUSTOMER_ID/adGroups:mutate  

Google Ads API Forum Advisor Prod

unread,
Nov 23, 2020, 1:54:53 AM11/23/20
to swi...@convoyant.com, adwor...@googlegroups.com

Hi Steve,

Thank you for reaching out.

You may refer to this guide on how you can derive and construct URLs if you choose to use the REST interface for mutate requests.

I hope this helps and please let me know if you have additional clarifications.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q27vHQp:ref

Salomey Arthur

unread,
Jun 3, 2021, 10:10:23 AM6/3/21
to AdWords API and Google Ads API Forum
Hi guys, please i have been struggling with the Rest API request body for creating new ad campaign. I keep getting response errors. Please help me with the correct request body. The operations involved for 'create' are many. I have read all about it too. Please check my code and help me correct it:

$curl = curl_init();
            curl_setopt_array($curl, array(
            CURLOPT_URL => "https://googleads.googleapis.com/v7/customers/{my customer id here}/campaigns:mutate",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_FOLLOWLOCATION => false,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS =>"{
                'operations': [
                  {
                    'create': {
                      'name': 'First Campaign #{1}',
                      'advertisingChannelType': 'SEARCH',
                      'status': 'PAUSED',
                      'networkSettings': {
                          'targetGoogleSearch': true,
                            'targetSearchNetwork': true,
                            'targetContentNetwork': false,
                            'targetPartnerSearchNetwork': false
                      },
                        'startDate': '{$start_date}',
                        'endDate': '{$end_date}',
                        'paymentMode': 'CLICKS',
                       'campaigneBudget': '5'                   
                    }
                  }
                ],
                  'partialFailure': false,
                  'validateOnly': false
            }",
            CURLOPT_HTTPHEADER => array(
                "Content-Type: application/json",
                "developer-token: {my developer token here}",
                "login-customer-id: {my manager id here}",
                "Authorization: Bearer {my auth token}"
                ),
            ));
            $response = curl_exec($curl);
           
            curl_close($curl);
           
            var_dump($response)

Urgent solution needed. Please help.

Bram van Rijswijk

unread,
Jun 3, 2021, 11:22:01 AM6/3/21
to AdWords API and Google Ads API Forum
Hi, change 'campaigneBudget' to 'campaign_budget'. Before you create a campaign you have to create a budget. See this page: https://developers.google.com/google-ads/api/rest/examples.

Bram van Rijswijk

unread,
Jun 3, 2021, 11:25:33 AM6/3/21
to AdWords API and Google Ads API Forum
Ah I see 'campaignBudget' can also be used. We use 'campaign_budget'. As long as it has the resource name, it will work.

Salomey Arthur

unread,
Jun 3, 2021, 12:54:05 PM6/3/21
to AdWords API and Google Ads API Forum
Thanks Bram for the response.

I found the solution to it not long ago. There are two ways involved if using Rest API.

First instance is a request body that initializes multiple campaign operations(campaign budget, campaign, AdGroup, Text Ad) with one endpoint.

Second instance is individual request bodies for each operation with different endpoints matching them.
I opted for the second and it's also supposed to follow the sequence(1st: campaign budget, 2nd: campaign, 3rd: AdGroup, 4th: Text Ad). My problem was, i attempted creating campaign individually whilst i hadn't created it's budget first.

Everything is running well now.

I really appreciate the prompt response from you though.
Thanks again Bram.

Salomey Arthur

unread,
Jun 3, 2021, 1:08:58 PM6/3/21
to AdWords API and Google Ads API Forum
Hi Bram,

Please one more thing: I get errors when i send request to generate keyword ideas. The request body is quite large and i keep getting errors. Please i'm still using Rest API.
Can you please help me with a quick example for the request body to generate keyword ideas?
This is the endpoint: https://googleads.googleapis.com/v7/customers/{customer id}:generateKeywordIdeas

Google Ads API Forum Advisor Prod

unread,
Jun 4, 2021, 1:50:39 AM6/4/21
to poeti...@gmail.com, adwor...@googlegroups.com
Hi,

I'm from the API support team and allow me to chime in on your concern.

Examples are currently limited and we do not have one specific to what you are looking for. That said, could you share the error you are encountering so our team can have a closer look?

Salomey Arthur

unread,
Jun 4, 2021, 8:24:20 AM6/4/21
to AdWords API and Google Ads API Forum
Hello Peter,

Thanks for reaching out. Please check out my code for generating the keyword ideas:

$curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://googleads.googleapis.com/v7/customers/{customer id}:generateKeywordIdeas",

    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS =>"{
        'geoTargetConstants': ['USA','Canada'],
        'includeAdultKeywords': 'false',
        'pageToken': '1',
        'pageSize': '1000',
        'keywordPlanNetwork': 'GOOGLE_SEARCH',
        'keywordAnnotation': ['KEYWORD_CONCEPT'],
        'aggregateMetrics': 'DEVICE',
        'language': 'English',
        'siteSeed': {
            'site': 'https://www.example.com'

            }
    }",
    CURLOPT_HTTPHEADER => array(
        "Content-Type: application/json",
        "developer-token: {developer token}",
        "login-customer-id: {manager id}",
        "Authorization: Bearer {bearer token}"

        ),
    ));
    $response = curl_exec($curl);
    
    curl_close($curl);
    var_dump($response);

Salomey Arthur

unread,
Jun 4, 2021, 1:55:54 PM6/4/21
to AdWords API and Google Ads API Forum
Ok guys, i just found the solution to the request body for generating keyword ideas. I have made the necessary correction and my code is running alright along with the Rest API.
Thanks to all who had intention to help me with a solution.
Reply all
Reply to author
Forward
0 new messages