What is wrong with my code?

79 views
Skip to first unread message

David Scott

unread,
Feb 27, 2024, 2:11:01 PM2/27/24
to Google Ads API and AdWords API Forum
$command = qq(curl -i -X POST \\
  "https://googleads.googleapis.com/v16/customers/$Certified_Santee/adGroupAds:mutate" \\
  --header "Content-Type: application/json" \\
  --header "developer-token: $developer_token" \\
  --header "Authorization: Bearer $access_token" \\
  --data '
    {
      "operations":
      [
        "adGroupAdOperation":
        {
          "create":
          {
            "adGroup": "customers/$Certified_Santee/adGroupAds/$Santee_SSA4_Transmission",
            "status": "PAUSED",
            "ad":
            {
              "expandedTextAd":
              {
                "headlines":
                [
                  {
                    "pinnedField": "HEADLINE_1",
                    "text": "1985 Alfa Romeo Spider"
                  },
                  {
                    "text": "Alfa Romeo Spider transmission"
                  },
                  {
                    "text": "Alfa Romeo transmissions"
                  }
                ],

                "descriptions":
                [
                  {
                    "text": "Our experts are Alfa Romeo specialists. Many reman transmissions in stock."
                  },
                  {
                    "text": "Certified Transmission Santee is a full Alfa Romeo transmission diagnostic center."
                  }
                ],
                "displayUrl": "$domain/ls_1985_Alfa_Romeo_Spider-transmission.shtml"
              }
            }
          }
        }
      ]
    }

');

@result = qx{$command};
print "@result\n";

Result:
{
   "error": {
     "code": 400,
     "message": "Invalid JSON payload received. Expected , or ] after array value.\n\"adGroupAdOperation\": \n        [\n       \n                    ^",
     "status": "INVALID_ARGUMENT"
   }
 }

Google Ads API Forum Advisor

unread,
Feb 27, 2024, 5:59:49 PM2/27/24
to davidni...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads API support team.

Upon checking the provided logs, we found that you are getting an invalid argument error when creating adGroupAds via the Google Ads API. Kindly check below for troubleshooting steps that might help resolve your issue.

I would suggest you check the AdGroupAdOperation API REST Explorer to know the valid arguments you have to pass as a request to create ad group ads.

I hope it helps. 

This message is in relation to case "ref:!00D1U01174p.!5004Q02rzV1f:ref"

Thanks,
 
Google Logo Google Ads API Team


Google Ads API Forum Advisor

unread,
Feb 27, 2024, 6:03:12 PM2/27/24
to davidni...@gmail.com, adwor...@googlegroups.com

Hi,

Please ignore my previous mail.

Reply all
Reply to author
Forward
0 new messages