Get all userlists on an account and list their names and id's in java

36 views
Skip to first unread message

Thomas Bisballe

unread,
Nov 19, 2018, 3:29:44 PM11/19/18
to AdWords API and Google Ads API Forum
How do i get all userlists from an account and list all their names and id's.

When i run

AdwordsUserListServiceInterface userListService = adWordsServices.get(session,AdwordsUserListServiceInterface.class);
Selector serviceSelector = new Selector();
String[] fields = {"id","name"};
serviceSelector.setFields(fields);
UserListPage result = userListService.get(serviceSelector);

i get invalid field ids error

But on the page


id and name are valid id's

Dannison Yao (AdWords API Team)

unread,
Nov 19, 2018, 5:42:07 PM11/19/18
to AdWords API and Google Ads API Forum
Hi Thomas,

The selector fields are case-sensitive. You could try using "Id" and "Name" in your selector with proper capitalization. If this does not solve the problem, could you provide the complete SOAP request and response logs so I could investigate this further? You may send them to me via the reply privately to author option.

Regards,
Dannison
AdWords API Team

Thomas Bisballe

unread,
Nov 20, 2018, 7:19:40 AM11/20/18
to AdWords API and Google Ads API Forum
[19 Nov 2018 21:25:45,554-requestInfoLogger:WARN:main] Request made: Service: AdwordsUserListService Method: get clientCustomerId: 912-093-0506 URL: https://adwords.google.com/api/adwords/rm/v201802/AdwordsUserListService Request ID: 00057b0a525fdd680a81379751017e22 ResponseTime(ms): 167 OperationsCount: 1 IsFault: true FaultMessage: ApiException{applicationExceptionType=ApiException, errors=[SelectorError{apiErrorType=SelectorError, errorString=SelectorError.INVALID_FIELD_NAME, fieldPath=serviceSelector, fieldPathElements=[FieldPathElement{field=serviceSelector}], reason=INVALID_FIELD_NAME, trigger=BasicUserList}]}
[19 Nov 2018 21:25:45,570-soapXmlLogger:INFO:main] SOAP request:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/rm/v201802" soapenv:mustUnderstand="0">
            <ns2:clientCustomerId xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201802">912-093-0506</ns2:clientCustomerId>
            <ns3:developerToken xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201802">REDACTED</ns3:developerToken>
            <ns4:userAgent xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201802">unknown (AwApi-Java, AdWords-Axis/3.14.0, Common-Java/3.14.0, Axis/1.4, Java/1.8.0_172, maven)</ns4:userAgent>
            <ns5:validateOnly xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201802">false</ns5:validateOnly>
            <ns6:partialFailure xmlns:ns6="https://adwords.google.com/api/adwords/cm/v201802">false</ns6:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <serviceSelector>
                <ns7:fields xmlns:ns7="https://adwords.google.com/api/adwords/cm/v201802">BasicUserList</ns7:fields>
            </serviceSelector>
        </get>
    </soapenv:Body>
</soapenv:Envelope>


[19 Nov 2018 21:25:45,571-soapXmlLogger:INFO:main] SOAP response:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
            <requestId>00057b0a525fdd680a81379751017e22</requestId>
            <serviceName>AdwordsUserListService</serviceName>
            <methodName>get</methodName>
            <operations>1</operations>
            <responseTime>167</responseTime>
        </ns2:ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>[SelectorError.INVALID_FIELD_NAME @ serviceSelector; trigger:'BasicUserList']</faultstring>
            <detail>
                <ns2:ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201802" xmlns:ns2="https://adwords.google.com/api/adwords/rm/v201802">
                    <message>[SelectorError.INVALID_FIELD_NAME @ serviceSelector; trigger:'BasicUserList']</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SelectorError">
                        <fieldPath>serviceSelector</fieldPath>
                        <fieldPathElements>
                            <field>serviceSelector</field>
                        </fieldPathElements>
                        <trigger>BasicUserList</trigger>
                        <errorString>SelectorError.INVALID_FIELD_NAME</errorString>
                        <ApiError.Type>SelectorError</ApiError.Type>
                        <reason>INVALID_FIELD_NAME</reason>
                    </errors>
                </ns2:ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>
Reply all
Reply to author
Forward
0 new messages