ResponsiveSearchAdInfo - Google Ads v16

18 Views Asked by At

I have an issue with the Google Ads v16 version. This particular method is causing problems, and I can't update either the descriptions or the headlines. Here is my code, taken from an example of the API for this specific version:

Api reference: https://developers.google.com/google-ads/api/samples/update-responsive-search-ad

If I remove the ResponsiveSearchAdInfo method, for example, to only update the final_urls, this works successfully.

The error it gives me is the following:

error: {
    "message": "Request contains an invalid argument.",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": [
        {
            "@type": "type.googleapis.com\/google.ads.googleads.v16.errors.GoogleAdsFailure",
            "errors": [
                {
                    "errorCode": {
                        "requestError": "UNKNOWN"
                    },
                    "message": "The error code is not in this version.",
                    "location": {
                        "fieldPathElements": [
                            {
                                "fieldName": "operations",
                                "index": 0
                            },
                            {
                                "fieldName": "update"
                            },
                            {
                                "fieldName": "resource_name"
                            }
                        ]
                    }
                }
            ],
            "requestId": "qub0AMx1K3uIn8f0pUvKlg"
        }
    ]
}

It seems strange to me that it references resource_name, as without changing anything in that line, I send the parameter to change the URL, and it works fine. By the way, in my controller, I'm not handling this as a static function, like the example shown in the API.

This is mi code:

    $ad = new Ad([
        'resource_name' => ResourceNames::forAd($customerId, $adId),
        'final_urls' => [$finalUrls],
        'final_mobile_urls' => [$finalUrls],  
        'responsive_search_ad' => new ResponsiveSearchAdInfo([
            // Update some properties of the responsive search ad.
            'headlines' => [
                new AdTextAsset([
                    'text' => 'Cruise to Pluto #' ,
                    'pinned_field' => ServedAssetFieldType::HEADLINE_1
                ]),
                new AdTextAsset(['text' => 'Tickets on sale now']),
                new AdTextAsset(['text' => 'Buy your ticket now'])
            ],
            'descriptions' => [
                new AdTextAsset(['text' => 'Best space cruise ever.']),
                new AdTextAsset([
                    'text' => 'The most wonderful space experience you will ever have.'])
            ]
        ]),       

    ]);

Any help is welcome. Thank you!

0

There are 0 best solutions below