How to update assets in an App campaign via Adwords API

76 views
Skip to first unread message

Rita Wang

unread,
Aug 12, 2019, 10:52:15 PM8/12/19
to AdWords API and Google Ads API Forum
Hi

My client is trying to update assets of an ads in an app campaign:

async function addAdGroupAds (service, a) {
    const adSetvice = service.getAdService();
    const operations = [{
        operator: 'SET',
        operand:
        {
            'xsi:type': 'UniversalAppAd',
            id: 'xxxxxxxx',
            images: [
                {
                    asset: {
                        "attributes": {
                            'xsi:type': 'ImageAsset',
                        },
                        assetId: 'xxxx'
                    }
                }
            ]
        }
    }];
    await adSetvice.mutate({operations: operations});
}

Got following error:
{"Fault":{"faultcode":"soap:Client","faultstring":"[CollectionSizeError.TOO_FEW @ operations[0].operand.headlines, CollectionSizeError.TOO_FEW @ operations[0].operand.descriptions]","detail":{"ApiExceptionFault":{"message":"[CollectionSizeError.TOO_FEW @ operations[0].operand.headlines, CollectionSizeError.TOO_FEW @ operations[0].operand.descriptions]","ApplicationException.Type":"ApiException","errors":[{"attributes":{"xsi:type":"CollectionSizeError"},"fieldPath":"operations[0].operand.headlines","fieldPathElements":[{"field":"operations","index":0},{"field":"operand"},{"field":"headlines"}],"trigger":"","errorString":"CollectionSizeError.TOO_FEW","ApiError.Type":"CollectionSizeError","reason":"TOO_FEW"},{"attributes":{"xsi:type":"CollectionSizeError"},"fieldPath":"operations[0].operand.descriptions","fieldPathElements":[{"field":"operations","index":0},{"field":"operand"},{"field":"descriptions"}],"trigger":"","errorString":"CollectionSizeError.TOO_FEW","ApiError.Type":"CollectionSizeError","reason":"TOO_FEW"}]}}}}}},"response":{"statusCode":500,"body":"<soap:Envelope xmlns:


Based on this error and the doc(ss), I suggested them to add headlines and descriptions in the request.
They re-tried with the following code:
async function addAdGroupAds (service, a) {
    const adSetvice = service.getAdService();
    const operations = [{
        operator: 'SET',
        operand:
        {
            'xsi:type': 'UniversalAppAd',
            id: 'xxxxxxxx',
            images: [
                {
                    asset: {
                        "attributes": {
                            'xsi:type': 'ImageAsset',
                        },
                        assetId: 'xxxx'
                    }
                }
            ],
            headlines: [
                {
                    "asset": {
                        "attributes": {
                            "xsi:type": "TextAsset"
                        },
                        "assetId": "xxxx",
                        "assetSubtype": "TEXT",
                        "Asset.Type": "TextAsset",
                        "assetText": "xxxx"
                    }
                },
                {
                    "asset": {
                        "attributes": {
                            "xsi:type": "TextAsset"
                        },
                        "assetId": "xxxxx",
                        "assetSubtype": "TEXT",
                        "Asset.Type": "TextAsset",
                        "assetText": "xxxx"
                    },
                },
                {
                    "asset": {
                        "attributes": {
                            "xsi:type": "TextAsset"
                        },
                        "assetId": "xxxx",
                        "assetSubtype": "TEXT",
                        "Asset.Type": "TextAsset",
                        "assetText": "xxx"
                    },
                },
                {
                    "asset": {
                        "attributes": {
                            "xsi:type": "TextAsset"
                        },
                        "assetId": "xxx",
                        "assetSubtype": "TEXT",
                        "Asset.Type": "TextAsset",
                        "assetText": "xxxxx"
                    },
                }
            ],
            descriptions: [
                {
                    "asset": {
                        "attributes": {
                            "xsi:type": "TextAsset"
                        },
                        "assetId": "xxxx",
                        "assetSubtype": "TEXT",
                        "Asset.Type": "TextAsset",
                        "assetText": "xxxx"
                    },
                }
            ]
        },
    }];
    await adSetvice.mutate({operations: operations});
}

The returned error is:
Invalid content was found starting with element '{\"https://adwords.google.com/api/adwords/cm/v201809\":headlines}'. One of '{\"https://adwords.google.com/api/adwords/cm/v201809\":images, \"https://adwords.google.com/api/adwords/cm/v201809\":videos, \"https://adwords.google.com/api/adwords/cm/v201809\":html5MediaBundles}' is expected."}}}},"response":{"statusCode":500,....

Any suggestions?

Google Ads API Forum Advisor Prod

unread,
Aug 13, 2019, 2:34:26 AM8/13/19
to adwor...@googlegroups.com
Hi Rita,

The Headlines and Descriptions fields of the UniversalAppAd are not required for SET operations. That said, could you provide the complete SOAP request and response logs that were generated when the client encountered the CollectionSizeError.TOO_FEW error? You may then send your reply via the Reply privately to author option.

If you haven't enabled logging for your client library, could you confirm which one you are using so I can provide the appropriate guide?

Thanks and regards,
Peter
Google Ads API Team

ref:_00D1U1174p._5001UEIowf:ref
Reply all
Reply to author
Forward
0 new messages