INVALID_FIELD_NAME Error For requesting Multiple Selector Fields in CampaignService

20 views
Skip to first unread message

Jagadish B

unread,
Feb 10, 2021, 2:39:32 AM2/10/21
to AdWords API and Google Ads API Forum
I'm trying to send XML based Adwords API request to CampaignService.

As per the API documentation for the CampaignService  we can pass on multiple selector fields in the XML request. But I don't understand the format in which these fields should be passed on ..

I have tried the following formats for requesting Campaign Id and Campaign Name selector fields, but it is giving me INVALID_FIELD_NAME error.

Formats tried :  'Id','Name'  ;  [Id,Name]  ; ['Id','Name']  ----  All raising same error.
both Id and Name are valid fields for the CampaignService.

Can any help me with what should be the format in which these selector formats should be passed on?

I attach the XML request body and Error below

   <soapenv:Header>
      <v20:RequestHeader>
         <!--Optional:-->
         <v201:clientCustomerId>767-***-9100</v201:clientCustomerId>
         <!--Optional:-->
         <v201:developerToken>c********nitijDtDzSklQ</v201:developerToken>
         <!--Optional:-->
         <v201:userAgent>SoapUI</v201:userAgent>
         <!--Optional:-->
         <v201:validateOnly>true</v201:validateOnly>
         <!--Optional:-->
         <v201:partialFailure>false</v201:partialFailure>
      </v20:RequestHeader>
   </soapenv:Header>
   <soapenv:Body>
      <v20:get>
         <!--Optional:-->
         <v20:serviceSelector>
            <!--Zero or more repetitions:-->
            <v201:fields>[Id,Name]</v201:fields>
            <!--Zero or more repetitions:-->
            <v201:predicates>
               <!--Optional:-->
               <v201:field>StartDate</v201:field>
               <!--Optional:-->
               <v201:operator>GREATER_THAN_EQUALS</v201:operator>
               <!--Zero or more repetitions:-->
               <v201:values>20200101</v201:values>
            </v201:predicates>
            <!--Optional:-->
            <v201:dateRange>
               <!--Optional:-->
               <v201:min>20200101</v201:min>
               <!--Optional:-->
               <v201:max>20210131</v201:max>
            </v201:dateRange>
            <!--Zero or more repetitions:-->
            <v201:ordering>
               <!--Optional:-->
               <v201:field>StartDate</v201:field>
               <!--Optional:-->
               <v201:sortOrder>ASCENDING</v201:sortOrder>
            </v201:ordering>
            <!--Optional:-->
            <v201:paging>
               <!--Optional:-->
               <v201:startIndex>0</v201:startIndex>
               <!--Optional:-->
               <v201:numberResults>3</v201:numberResults>
            </v201:paging>
         </v20:serviceSelector>
      </v20:get>
   </soapenv:Body>
</soapenv:Envelope>

Error Msg:
The remote server returned an error: (500) Internal Server Error.

Status Code: InternalServerError

Response Body: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809"><requestId>0005baf675ca44de0a62e20866020df5</requestId><serviceName>CampaignService</serviceName><methodName>get</methodName><operations>0</operations><responseTime>149</responseTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>[SelectorError.INVALID_FIELD_NAME @ serviceSelector; trigger:'[Id,Name]']</faultstring><detail><ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809"><message>[SelectorError.INVALID_FIELD_NAME @ serviceSelector; trigger:'[Id,Name]']</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>[Id,Name]</trigger><errorString>SelectorError.INVALID_FIELD_NAME</errorString><ApiError.Type>SelectorError</ApiError.Type><reason>INVALID_FIELD_NAME</reason></errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>

Much appreciate your help on this.

Jagadish B

unread,
Feb 10, 2021, 7:40:52 AM2/10/21
to AdWords API and Google Ads API Forum
Okay,  I think each field need to be in a separate line of code all together.

  <v201:fields>Id</v201:fields>
  <v201:fields>Name</v201:fields>

Google Ads API Forum Advisor Prod

unread,
Feb 10, 2021, 1:48:51 PM2/10/21
to jaga...@perceptive-analytics.com, adwor...@googlegroups.com
Hello,

You will need a separate line for each field. You can find an example of what the SOAP request should look like here.

Regards,
Anthony

Google Logo
Anthony
Google Ads API Team
 


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