Hello,

I apologize; I actually made a mistake. The "choice"-type elements for rule 
items are actually one place where you do use a tag rather than XSI type.

So, for example, the add_rule_based_remarketing_list.rb example from the 
Ruby client library generates a body that looks like this (significantly 
more complicated than what you're trying to do, but still demonstrates 
valid format):

   <env:Body>
      <mutate xmlns="https://adwords.google.com/api/adwords/rm/v201509";>
         <operations>
            <ns0:operator>ADD</ns0:operator>
            <operand xsi:type="ExpressionRuleUserList">
               <name>Users who checked out in November or December OR visited 
the checkout page with more than one item in their cart</name>
               <description>Expression based user list</description>
               <rule>
                  <groups>
                     <items>
                        <StringRuleItem>
                           <key>
                              <name>ecomm_pagetype</name>
                           </key>
                           <op>EQUALS</op>
                           <value>checkout</value>
                        </StringRuleItem>
                        <NumberRuleItem>
                           <key>
                              <name>cartsize</name>
                           </key>
                           <op>GREATER_THAN</op>
                           <value>1.0</value>
                        </NumberRuleItem>
                     </items>
                  </groups>
                  <groups>
                     <items>
                        <DateRuleItem>
                           <key>
                              <name>checkoutdate</name>
                           </key>
                           <op>AFTER</op>
                           <value>20141031</value>
                        </DateRuleItem>
                        <DateRuleItem>
                           <key>
                              <name>checkoutdate</name>
                           </key>
                           <op>BEFORE</op>
                           <value>20150101</value>
                        </DateRuleItem>
                     </items>
                  </groups>
               </rule>
            </operand>
         </operations>
         <operations>
            <ns0:operator>ADD</ns0:operator>
            <operand xsi:type="DateSpecificRuleUserList">
               <name>Date rule user list created at 2015-12-18 09:52:45 
-0500</name>
               <description>Users who visited the site between 20141031 and 
20150331 and checked out in November or December OR visited the checkout page 
with more than one item in their cart</description>
               <rule>
                  <groups>
                     <items>
                        <StringRuleItem>
                           <key>
                              <name>ecomm_pagetype</name>
                           </key>
                           <op>EQUALS</op>
                           <value>checkout</value>
                        </StringRuleItem>
                        <NumberRuleItem>
                           <key>
                              <name>cartsize</name>
                           </key>
                           <op>GREATER_THAN</op>
                           <value>1.0</value>
                        </NumberRuleItem>
                     </items>
                  </groups>
                  <groups>
                     <items>
                        <DateRuleItem>
                           <key>
                              <name>checkoutdate</name>
                           </key>
                           <op>AFTER</op>
                           <value>20141031</value>
                        </DateRuleItem>
                        <DateRuleItem>
                           <key>
                              <name>checkoutdate</name>
                           </key>
                           <op>BEFORE</op>
                           <value>20150101</value>
                        </DateRuleItem>
                     </items>
                  </groups>
               </rule>
               <startDate>20141031</startDate>
               <endDate>20150331</endDate>
            </operand>
         </operations>
      </mutate>
   </env:Body>


One notable difference is that the operator element has a namespace 
defined. ns0 in this example request is defined on the Envelope as 
xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201509";.

Try specifying the correct namespace on your operator to see if that 
resolves the problem.

Again, I apologize for getting it wrong at first; this is actually one of 
the only places in the API where xsi:type isn't used to differentiate.

Regards,
Mike, AdWords API Team

On Thursday, December 17, 2015 at 6:01:08 PM UTC-5, ra...@woopra.com wrote:
>
> Hi Mike--
>
> I got my client to build a request that looks just like yours, but now i'm 
> getting the error about being unable to construct a ruleItem because it is 
> abstract:
>
> Cannot construct an instance of com.google.ads.api.services.datax.
> userlists.rule.RuleItem because it is abstract.  You are probably missing 
> an @Uses annotation while invoking public abstract com.google.ads.api.
> services.datax.userlists.UserListReturnValue com.google.ads.api.services.
> datax.adwordsuserlist.AdwordsUserListService.mutate(java.util.List) throws 
> com.google.ads.api.services.common.error.ApiException with params [[com.
> google.ads.api.services.datax.adwordsuserlist.v201509.jaxbgen.
> UserListOperation@47c87410]].
>
> I've seen your answers to a couple other posts about similar statements, 
> but the format of the xml requests in the answers in those threads are 
> different enough that I can't adapt them to my own.  Here is the body of my 
> request fixed to look like yours:
>
>
>   <soap:Body>
>       <mutate xmlns="https://adwords.google.com/api/adwords/rm/v201509";>
>          <operations>
>             <operator>ADD</operator>
>             <operand xsi:type="ExpressionRuleUserList">
>                <name>Woopra_test_label_Id</name>
>                <integrationCode>test_label_Id</integrationCode>
>                <rule>
>                   <groups>
>                      <items xsi:type="StringRuleItem">
>                         <key>
>                            <name>Woopra_test_label_Id</name>
>                         </key>
>                         <op>EQUALS</op>
>                         <value>true</value>
>                      </items>
>                   </groups>
>                </rule>
>             </operand>
>          </operations>
>       </mutate>
>    </soap:Body>
>
>
>
> thanks
> --Ralph
>
>
> On Wednesday, December 16, 2015 at 7:01:17 AM UTC-8, Michael Cloonan 
> (AdWords API Team) wrote:
>>
>> Hello,
>>
>> Rather than have a tag <ExpressionRuleUserList>, you should have <operand 
>> xsi:type="ExpressionRuleUserList">. The fields for the 
>> ExpressionRuleUserList go directly within the operand. Similarly, instead 
>> of <StringRuleItem>, you should have <items xsi:type="StringRuleItem">, and 
>> then the StringRuleItem attributes go directly within the <items> tag. Just 
>> to make it cleaner, you should also remove the <id> altogether, rather than 
>> specifying it as nil.
>>
>> I am confused about why you're getting an error pointing to the operator, 
>> but hopefully cleaning up the operand to have the correct format by 
>> following the instructions above will fix it anyway.
>>
>> Just to be clear, the SOAP body you posted most recently, with 
>> corrections, should look like this:
>>
>>  <soap:Body>
>>       <mutate xmlns="https://adwords.google.com/api/adwords/rm/v201509";>
>>          <operations>
>>             <operator>ADD</operator>
>>             <operand xsi:type="ExpressionRuleUserList">
>>                <name>Woopra Label: test-label-Id</name>
>>                <integrationCode>test-label-Id</integrationCode>
>>                <rule>
>>                   <groups>
>>                      <items xsi:type="StringRuleItem">
>>                         <key>Woopra_Label-test-label-Id</key>
>>                         <op>EQUALS</op>
>>                         <value>true</value>
>>                      </items>
>>                   </groups>
>>                </rule>
>>             </operand>
>>          </operations>
>>       </mutate>
>>    </soap:Body>
>>
>> Regards,
>> Mike, AdWords API Team
>>
>>
>> On Wednesday, December 16, 2015 at 2:28:48 AM UTC-5, ra...@woopra.com 
>> wrote:
>>>
>>> Ok I have tried probably 30 combinations now.  I still get the same 
>>> error: 
>>>
>>> `[OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0], 
>>> RequiredError.REQUIRED @ operations[0].operator]`
>>>
>>> Unless I mess up the whole operation in which case it adds to the errors 
>>> list: `RequiredError.REQUIRED @ operations[0].operand` Which happens when I 
>>> try and wrap the operator/operand pair in another object like 
>>> "UserListOperation"
>>> So what this means to me is that the operand is not being read correctly.
>>>
>>> I'm not sure exactly what you meant by "You need to use the 
>>> ExpressionRuleUserList 
>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.ExpressionRuleUserList>
>>>  to 
>>> add the RuleItem 
>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.RuleItem>
>>>  instead 
>>> of the RuleBasedUserList 
>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.RuleBasedUserList>."
>>>  
>>> Perhaps you can make your suggestions directly on the xml that I send so 
>>> that i can figure out how to get that output from my soap client?  But 
>>> since no matter what I do to the operand the error says the same thing 
>>> about the operator, I feel like there is something wrong there.  should it 
>>> be literally "<ADD />" or "ADD" or what?  There isn't much room to play 
>>> with the operator though...that's the flaw in my theory. :)
>>>
>>> Here's just the body of a cleaner attempt:
>>>
>>>  <soap:Body>
>>>       <mutate xmlns="https://adwords.google.com/api/adwords/rm/v201509";>
>>>          <operations>
>>>             <operator>ADD</operator>
>>>             <operand>
>>>                <ExpressionRuleUserList>
>>>                   <id xsi:nil="true" />
>>>                   <name>Woopra Label: test-label-Id</name>
>>>                   <integrationCode>test-label-Id</integrationCode>
>>>                   <rule>
>>>                      <groups>
>>>                         <items>
>>>                            <StringRuleItem>
>>>                               <key>Woopra_Label-test-label-Id</key>
>>>                               <op>EQUALS</op>
>>>                               <value>true</value>
>>>                            </StringRuleItem>
>>>                         </items>
>>>                      </groups>
>>>                   </rule>
>>>                </ExpressionRuleUserList>
>>>             </operand>
>>>          </operations>
>>>       </mutate>
>>>    </soap:Body>
>>>
>>>
>>>
>>> Thanks again
>>> --Ralph
>>>
>>>
>>> On Tuesday, December 15, 2015 at 9:33:57 AM UTC-8, Umesh Dengale wrote:
>>>>
>>>> Hi Ralph,
>>>>
>>>> Thanks for providing the SOAP XML request. The RuleItem is associated 
>>>> with DateSpecificRuleUserList 
>>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.DateSpecificRuleUserList>
>>>>  and ExpressionRuleUserList 
>>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.ExpressionRuleUserList>.
>>>>  
>>>> You need to use the ExpressionRuleUserList 
>>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.ExpressionRuleUserList>
>>>>  to 
>>>> add the RuleItem 
>>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.RuleItem>
>>>>  instead 
>>>> of the RuleBasedUserList 
>>>> <https://developers.google.com/adwords/api/docs/reference/v201509/AdwordsUserListService.RuleBasedUserList>
>>>> .
>>>> I will submit a feature request for node/js client library.
>>>>
>>>> Thanks,
>>>> Umesh, AdWords API Team.
>>>>
>>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/4d4c3ea2-c5e5-49f4-a589-aa30ec519ec1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to