Why is ManagedCustomer.accountLabels always NULL?

140 views
Skip to first unread message

Zweitze

unread,
Jun 3, 2015, 5:56:20 PM6/3/15
to adwor...@googlegroups.com
Hi,

I'm trying to retrieve the labels of an account. To my surprise it is always NULL.
Sample code (C#)

    ManagedCustomerService mcs = User.GetService(
    AdWordsService.v201502.ManagedCustomerService);

    Selector Selector = new Selector();
    Selector.fields = new string[] { "CustomerId", "AccountLabels",
        "Name", "CompanyName", "CanManageClients" };

    ManagedCustomerPage mcp = mcs.get(Selector);

And then I end up with exactly one ManagedCustomer, where attributes customerId, name, companyName and canManageClients are all set, but accountLabels is not.
I tested this with MCC 437-819-4458 (meaning, the refreshToken was issued to a login to this MCC) and CustomerId 892-838-4200. In the AdWords web interface, when logged in to the same MCC, I see two labels.

A recent RequestId of such a call is 000517a3e84613800ac216e46100e07b.

I tried with requesting fewer fields, just CustomerId and AccountLabels, but attribute accountLabels remain empty. What am I doing wrong?

Thank in advance!

Josh Radcliff (AdWords API Team)

unread,
Jun 4, 2015, 5:06:41 PM6/4/15
to adwor...@googlegroups.com, zwe...@gmail.com
Hi,

It looks like you may be setting the clientCustomerId SOAP header to the child account, in which case you won't get the account labels back in the response because they are defined in the MCC account (437-819-4458), not the child account.

Instead, please try setting the clientCustomerId SOAP header to the MCC account that owns the account labels (437-819-4458 in this case), then add a predicate on CustomerId if you want to limit the request to specific child accounts.

Thanks,
Josh, AdWords API Team

Zweitze

unread,
Jun 9, 2015, 9:08:25 AM6/9/15
to adwor...@googlegroups.com, zwe...@gmail.com
Yes, that did the trick. Do not set clientCustomerId to the customer id you are interested in, but to the MCC, and use a predicate to limit the results.

Thank you!

Yang

unread,
Apr 12, 2016, 8:47:48 AM4/12/16
to AdWords API Forum, zwe...@gmail.com
Hi Josh. I'm having the same issue. I'm using the python client library, v201603 for your reference. I'm using the same top-level MCC for both AccountLabelService (which works) and ManagedCustomerService, which doesn't. If I use the the "AccountLabels" in the predicate of the selector, it fails with the following:

WebFault: Server raised fault: '[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro]'

However, if I just include "AccountLabels" as a column but not in the predicate, the query works but the results do not contain any "accountLabel" field. Below is my selector passed into ManagedCustomerService.

{'predicates': [{'operator': 'IN', 'field': 'AccountLabels', 'values': [4038216, 4038261]}], 'fields': ['AccountLabels', 'CanManageClients', 'CompanyName', 'CurrencyCode', 'CustomerId', 'DateTimeZone', 'Name', 'TestAccount'], 'paging': {'startIndex': '0', 'numberResults': '500'}}

Pls help, thanks!

Yang

Zweitze

unread,
Apr 12, 2016, 6:38:05 PM4/12/16
to AdWords API Forum, zwe...@gmail.com
Try passing the predicate values as string, as they should be:

{'predicates': [{'operator': 'IN', 'field': 'AccountLabels', 'values': ['4038216', '4038261']}], 'fields': ['AccountLabels', 'CanManageClients', 'CompanyName', 'CurrencyCode', 'CustomerId', 'DateTimeZone', 'Name', 'TestAccount'], 'paging': {'startIndex': '0', 'numberResults': '500'}}

Yang

unread,
Apr 12, 2016, 8:20:46 PM4/12/16
to AdWords API Forum, zwe...@gmail.com
Thanks for the suggestion. Just tried and it still doesn't work. Does it work for you? I.e. are you even able to pull any non-null AccountLabels out of the ManagedCustomerService, using the latest version, v201603?

Zweitze

unread,
Apr 13, 2016, 5:39:46 AM4/13/16
to AdWords API Forum, zwe...@gmail.com
I can get labels using C# on .NET 4.5, v201601 and without predicates. I get actual labels, not label ids.
My only help was pointing out that predicate values should be passed as an array of string, not as an array of long.
 
I suggest running it again, recording the requestId in the response, and posting that requestId here. The engineers in this forum can figure out what happened using those requestId, provided it's recent.

Josh Radcliff (AdWords API Team)

unread,
Apr 13, 2016, 12:38:59 PM4/13/16
to AdWords API Forum, zwe...@gmail.com
Hi,

Thanks, Zweitze, for helping out here. I just confirmed that with my test manager account, I do get back account labels if I include AccountLabels in the selector.

                <ns2:entries>
                    <ns2:name>Test 3</ns2:name>
                    <ns2:customerId>...</ns2:customerId>
                    <ns2:accountLabels>
                        <ns2:id>4099876</ns2:id>
                        <ns2:name>Express</ns2:name>
                    </ns2:accountLabels>
                </ns2:entries>

I also confirmed I was able to filter by AccountLabels, but make sure that you use one of CONTAINS_ALL, CONTAINS_ANY, or CONTAINS_NONE when filtering on this field, since the field is a collection of label IDs.

                <ns10:predicates xmlns:ns10="https://adwords.google.com/api/adwords/cm/v201601">
                    <ns10:field>AccountLabels</ns10:field>
                    <ns10:operator>CONTAINS_ANY</ns10:operator>
                    <ns10:values>4099876</ns10:values>
                </ns10:predicates>

Please give that a try and let me know if you're still encountering issues.

Thanks,
Josh, AdWords API Team

Yang

unread,
Apr 14, 2016, 4:31:16 AM4/14/16
to AdWords API Forum, zwe...@gmail.com
Thanks Josh and Zweitze for all the help. It works now for me if I change the version back to v201601. I was getting this error when using v201603 which is the latest release.

Yang

Josh Radcliff (AdWords API Team)

unread,
Apr 14, 2016, 9:00:55 AM4/14/16
to AdWords API Forum, zwe...@gmail.com
Hi Yang,

I just tried the same sequence in v201603, and it also returned labels and worked as expected when filtering by AccountLabels. If you are seeing differences in behavior between v201601 and v201603, could you send your requests and responses for each version only to me by clicking Reply privately to author on this message?

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages