Hi,

It's possible to update an AdGroupCriterion without specifying the
keyword text and match type, but you need to ensure the criterion
field is types as Criterion and not Keyword.  For example, this
section of the XML:

  <n2:criterion xsi:type="n2:Keyword">
    <n2:id>KEYWORDID</n2:id>
  </n2:criterion>

should look like:

  <n2:criterion>
    <n2:id>KEYWORDID</n2:id>
  </n2:criterion>

and your code should look like:

  keyword = ad_group_criterion_srv.module::Criterion.new
  keyword.id = KEYWORDID

Best,
- Eric Koleda, AdWords API Team

On Nov 20, 8:25 am, mariek <[email protected]> wrote:
> I am trying to update keyword text and its destinationUrl.
>
> 1. I specify it in the way showed below, and it updates correctly
> destinationUrl but text for keyword stay the same. In response there
> is also old text
> 2. It is also strange that if I specify adGroupId, keyword.id and
> don't specify keyword.text and keyword.matchType it will not perform
> update. Result is error that text and type is required.
>
> kwd_operation =
> ad_group_criterion_srv.module::AdGroupCriterionOperation.new
> kwd_operand =
> ad_group_criterion_srv.module::BiddableAdGroupCriterion.new
> kwd_operand.adGroupId = ADGROUPID
> keyword = ad_group_criterion_srv.module::Keyword.new
> keyword.matchType = 'BROAD'
> keyword.id = KEYWORDID
> keyword.text = 'text to update'
> kwd_operand.destinationUrl = URL
> kwd_operand.criterion = keyword
> kwd_operation.operand = kwd_operand
> kwd_operation.operator = 'SET'
> kwd_operation.exemptionRequests = []
>
> POINT 1 request and response
>
> ! CONNECT TO adwords.google.com:443
>
> ! CONNECTION ESTABLISHED
>
> POST /api/adwords/cm/v200909/AdGroupCriterionService HTTP/1.1
> SOAPAction: ""
> Content-Type: text/xml; charset=utf-8
> User-Agent: SOAP4R/1.5.8 (httpclient.rb/280, ruby 1.8.7 (2008-08-11)
> [i486-linux])
> Date: Fri, 20 Nov 2009 12:41:18 GMT
> Content-Length: 1596
> Host: adwords.google.com
>
> <?xml version="1.0" encoding="utf-8" ?>
> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";>
>   <env:Header>
>         <n1:RequestHeader env:mustUnderstand="0"
>             xmlns:n1="https://adwords.google.com/api/adwords/cm/
> v200909">
>           <n1:authToken>xxx</n1:authToken>
>           <n1:userAgent>adwords4r: xxxx</n1:userAgent>
>           <n1:applicationToken>xxx</n1:applicationToken>
>           <n1:developerToken>xxx</n1:developerToken>
>           <n1:clientEmail>xxxx</n1:clientEmail>
>         </n1:RequestHeader>
>   </env:Header>
>   <env:Body>
>     <n2:mutate xmlns:n2="https://adwords.google.com/api/adwords/cm/
> v200909">
>       <n2:operations xsi:type="n2:AdGroupCriterionOperation">
>         <n2:operator>SET</n2:operator>
>         <n2:operand xsi:type="n2:BiddableAdGroupCriterion">
>           <n2:adGroupId>ADGROUPID</n2:adGroupId>
>           <n2:criterion xsi:type="n2:Keyword">
>             <n2:id>KEYWORDID</n2:id>
>             <n2:text>text to update</n2:text>
>             <n2:matchType>BROAD</n2:matchType>
>           </n2:criterion>
>           <n2:destinationUrl>URL</n2:destinationUrl>
>         </n2:operand>
>       </n2:operations>
>     </n2:mutate>
>   </env:Body>
> </env:Envelope>
>
> = Response
>
> HTTP/1.1 200 OK
>
> Content-Type: text/xml; charset=UTF-8
>
> SOAPAction: ""
>
> Transfer-Encoding: chunked
>
> Date: Fri, 20 Nov 2009 12:41:17 GMT
>
> Expires: Fri, 20 Nov 2009 12:41:17 GMT
>
> Cache-Control: private, max-age=0
>
> X-Content-Type-Options: nosniff
>
> X-XSS-Protection: 0
>
> X-Frame-Options: SAMEORIGIN
>
> Server: GFE/2.0
>
> 614
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
> envelope/"><soap:Header><ResponseHeader xmlns="https://
> adwords.google.com/api/adwords/cm/
> v200909"><requestId>3da83ffe3f6331f2cc3b37e4031c1a18</
> requestId><operations>1</operations><responseTime>470</
> responseTime><units>3</units></ResponseHeader></
> soap:Header><soap:Body><mutateResponse xmlns="https://
> adwords.google.com/api/adwords/cm/
> v200909"><rval><ListReturnValue.Type>AdGroupCriterionReturnValue</
> ListReturnValue.Type><value xmlns:xsi="http://www.w3.org/2001/
> XMLSchema-instance"
> xsi:type="BiddableAdGroupCriterion"><adGroupId>820969566</
> adGroupId><criterion xsi:type="Keyword"><id>376765347</
> id><Criterion.Type>Keyword</Criterion.Type><text>TEXT</
> text><matchType>BROAD</matchType></
> criterion><AdGroupCriterion.Type>BiddableAdGroupCriterion</
> AdGroupCriterion.Type><userStatus>ACTIVE</
> userStatus><systemServingStatus>ELIGIBLE</
> systemServingStatus><approvalStatus>PENDING_REVIEW</
> approvalStatus><destinationUrl>URL</
> destinationUrl><bids
> xsi:type="ManualCPCAdGroupCriterionBids"><AdGroupCriterionBids.Type>ManualC 
> PCAdGroupCriterionBids</
> AdGroupCriterionBids.Type><maxCpc><amount><ComparableValue.Type>Money</
> ComparableValue.Type><microAmount>610000</microAmount></amount></
> maxCpc><bidSource>ADGROUP</bidSource></
> bids><firstPageCpc><amount><ComparableValue.Type>Money</
> ComparableValue.Type><microAmount>60000</microAmount></amount></
> firstPageCpc><qualityInfo><qualityScore>7</qualityScore></
> qualityInfo></value></rval></mutateResponse></soap:Body></
> soap:Envelope>
>
> 0
>
> ! CONNECTION CLOSED
>
> POINT 2 request and response
>
> = Request
>
> ! CONNECT TO adwords.google.com:443
>
> ! CONNECTION ESTABLISHED
>
> POST /api/adwords/cm/v200909/AdGroupCriterionService HTTP/1.1
> SOAPAction: ""
> Content-Type: text/xml; charset=utf-8
> User-Agent: SOAP4R/1.5.8 (httpclient.rb/280, ruby 1.8.7 (2008-08-11)
> [i486-linux])
> Date: Fri, 20 Nov 2009 12:25:24 GMT
> Content-Length: 1482
> Host: adwords.google.com
>
> <?xml version="1.0" encoding="utf-8" ?>
> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";>
>   <env:Header>
>         <n1:RequestHeader env:mustUnderstand="0"
>             xmlns:n1="https://adwords.google.com/api/adwords/cm/
> v200909">
>           <n1:authToken>xxxx</n1:authToken>
>           <n1:userAgent>xxx</n1:userAgent>
>           <n1:applicationToken>xxx</n1:applicationToken>
>           <n1:developerToken>xxxx</n1:developerToken>
>           <n1:clientEmail>xxxx</n1:clientEmail>
>         </n1:RequestHeader>
>   </env:Header>
>   <env:Body>
>     <n2:mutate xmlns:n2="https://adwords.google.com/api/adwords/cm/
> v200909">
>       <n2:operations xsi:type="n2:AdGroupCriterionOperation">
>         <n2:operator>SET</n2:operator>
>         <n2:operand xsi:type="n2:BiddableAdGroupCriterion">
>           <n2:adGroupId>ADGROUPID</n2:adGroupId>
>           <n2:criterion xsi:type="n2:Keyword">
>             <n2:id>KEYWORDID</n2:id>
>           </n2:criterion>
>           <n2:destinationUrl>URL WHICH I WANT TO SET</
> n2:destinationUrl>
>         </n2:operand>
>       </n2:operations>
>     </n2:mutate>
>   </env:Body>
> </env:Envelope>
>
> = Response
>
> HTTP/1.1 200 OK
>
> Content-Type: text/xml; charset=UTF-8
>
> Transfer-Encoding: chunked
>
> Date: Fri, 20 Nov 2009 12:25:23 GMT
>
> Expires: Fri, 20 Nov 2009 12:25:23 GMT
>
> Cache-Control: private, max-age=0
>
> X-Content-Type-Options: nosniff
>
> X-XSS-Protection: 0
>
> X-Frame-Options: SAMEORIGIN
>
> Server: GFE/2.0
>
> 573
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
> envelope/"><soap:Header><ResponseHeader xmlns="https://
> adwords.google.com/api/adwords/cm/
> v200909"><requestId>ecbfbbc4ddab908ec17214f978b9eb1c</
> requestId><operations>1</operations><responseTime>347</
> responseTime><units>3</units></ResponseHeader></
> soap:Header><soap:Body><soap:Fault><faultcode>soap:Server</
> faultcode><faultstring>[RequiredError.REQUIRED @ operations
> [0].operand.criterion.text, RequiredError.REQUIRED @ operations
> [0].operand.criterion.matchType]</
> faultstring><detail><ApiExceptionFault xmlns="https://
> adwords.google.com/api/adwords/cm/v200909"><message>
> [RequiredError.REQUIRED @ operations[0].operand.criterion.text,
> RequiredError.REQUIRED @ operations[0].operand.criterion.matchType]</
> message><ApplicationException.Type>ApiException</
> ApplicationException.Type><errors xmlns:xsi="http://www.w3.org/2001/
> XMLSchema-instance" xsi:type="RequiredError"><fieldPath>operations
> [0].operand.criterion.text</fieldPath><trigger></
> trigger><ApiError.Type>RequiredError</ApiError.Type><reason>REQUIRED</
> reason></errors><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-
> instance" xsi:type="RequiredError"><fieldPath>operations
> [0].operand.criterion.matchType</fieldPath><trigger></
> trigger><ApiError.Type>RequiredError</ApiError.Type><reason>REQUIRED</
> reason></errors></ApiExceptionFault></detail></soap:Fault></
> soap:Body></soap:Envelope>
>
> 0
>
> ! CONNECTION CLOSED

--

You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=.


Reply via email to