Hi Josh,
Thanks for your support.
1. Create Product Paritition on Empty Adgroup ( Adgroup Empty Process done
API ) - Its DONE now.
Now the issue is :
i can;t able to delete product partition in Single Mutate , By the way my
code is :
$adGroupId= "123456";
//Create selector.
$selector = new Selector();
$selector->fields = array('AdGroupId');
$selector->ordering = array(new OrderBy('Id', 'ASCENDING'));
// Create predicates.
$selector->predicates[] = new Predicate('AdGroupId', 'IN', array($));
$selector->predicates[] = new Predicate('CriteriaType', 'IN',
array('PRODUCT_PARTITION'));
$selector->predicates[] = new Predicate('CriterionUse', 'IN',
array('BIDDABLE'));
$result = $adGroupCriterionService->get($selector);
//echo '<pre>'; print_r($result); echo '</pre>'; //die;
$varProductPartitionCount = $result->totalNumEntries;
$operations = array();
$arrCriterionIds = array();
if($varProductPartitionCount>0 ) {
$operations = array();
for($varPPCount=0;$varPPCount<$varProductPartitionCount;$varPPCount++)
{
$arrCriterionIds[] = $result->entries[$varPPCount]->criterion->id;
}
//echo '<hr>'; echo '<pre>';print_r($arrCriterionIds); echo '</pre>';
echo '<hr>';
for($varCriterionCnt=0;
$varCriterionCnt<count($arrCriterionIds);$varCriterionCnt++)
{
$criterionId= $arrCriterionIds[$varCriterionCnt];
$criterion = new Criterion();
$criterion->id = $criterionId;
// Create ad group criterion.
$adGroupCriterion = new AdGroupCriterion();
$adGroupCriterion->adGroupId = $adGroupId;
$adGroupCriterion->criterion = new Criterion($criterionId);
// Create operation.
$operation = new AdGroupCriterionOperation();
$operation->operand = $adGroupCriterion;
$operation->operator = 'REMOVE';
$operations[] = $operation;
}
$result= $adGroupCriterionService->mutate($operations);
}
if i given " Mutate " Request within " Foreach " , its works fine
** My xml request and response is attached * Error is below*
Fatal error: Uncaught SoapFault exception: [soap:Server]
[AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @
operations[1].operand.criterion.id,
AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @
operations[2].operand.criterion.id] in
/var/www/bathrooms/adwords-api/Google/Api/Ads/Common/Lib/AdsSoapClient.php:216
Stack trace: #0
/var/www/bathrooms/adwords-api/Google/Api/Ads/Common/Lib/AdsSoapClient.php(216):
SoapClient->__soapCall('mutate', Array, NULL, Array, Array) #1
/var/www/bathrooms/adwords-api/Google/Api/Ads/AdWords/v201402/AdGroupCriterionService.php(8712):
AdsSoapClient->__soapCall('mutate', Array) #2
/var/www/bathrooms/adwords-api/alter_products_new.php(70):
AdGroupCriterionService->mutate(Array) #3 {main} thrown in
/var/www/bathrooms/adwords-api/Google/Api/Ads/Common/Lib/AdsSoapClient.php
on line 216
Thanks
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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=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 [email protected].
For more options, visit https://groups.google.com/d/optout.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201402">
<SOAP-ENV:Header>
<ns1:RequestHeader>
<ns1:clientCustomerId>XXX-XXX-XXXX</ns1:clientCustomerId>
<ns1:developerToken>XXXXX</ns1:developerToken>
<ns1:userAgent>[email protected] (AwApi-PHP/5.2.1, Common-PHP/5.2.1,
PHP/5.3.3-7+squeeze19)</ns1:userAgent>
</ns1:RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:get>
<ns1:serviceSelector>
<ns1:fields>AdGroupId</ns1:fields>
<ns1:predicates>
<ns1:field>AdGroupId</ns1:field>
<ns1:operator>IN</ns1:operator>
<ns1:values>14859103333</ns1:values>
</ns1:predicates>
<ns1:predicates>
<ns1:field>CriteriaType</ns1:field>
<ns1:operator>IN</ns1:operator>
<ns1:values>PRODUCT_PARTITION</ns1:values>
</ns1:predicates>
<ns1:predicates>
<ns1:field>CriterionUse</ns1:field>
<ns1:operator>IN</ns1:operator>
<ns1:values>BIDDABLE</ns1:values>
</ns1:predicates>
<ns1:ordering>
<ns1:field>Id</ns1:field>
<ns1:sortOrder>ASCENDING</ns1:sortOrder>
</ns1:ordering>
</ns1:serviceSelector>
</ns1:get>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Content-Encoding: gzip
Date: Mon, 16 Jun 2014 12:44:06 GMT
Expires: Mon, 16 Jun 2014 12:44:06 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 509
Server: GSE
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201402">
<requestId>0004fbf361f99d400a803e4f9e0098f3</requestId>
<serviceName>AdGroupCriterionService</serviceName>
<methodName>get</methodName>
<operations>1</operations>
<responseTime>250</responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201402">
<rval>
<totalNumEntries>3</totalNumEntries>
<Page.Type>AdGroupCriterionPage</Page.Type>
<entries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="BiddableAdGroupCriterion">
<adGroupId>14859103333</adGroupId>
<criterionUse>BIDDABLE</criterionUse>
<criterion xsi:type="ProductPartition">
<id>18283950120</id>
<type>PRODUCT_PARTITION</type>
<Criterion.Type>ProductPartition</Criterion.Type>
</criterion>
<AdGroupCriterion.Type>BiddableAdGroupCriterion</AdGroupCriterion.Type>
</entries>
<entries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="BiddableAdGroupCriterion">
<adGroupId>14859103333</adGroupId>
<criterionUse>BIDDABLE</criterionUse>
<criterion xsi:type="ProductPartition">
<id>77400162253</id>
<type>PRODUCT_PARTITION</type>
<Criterion.Type>ProductPartition</Criterion.Type>
</criterion>
<AdGroupCriterion.Type>BiddableAdGroupCriterion</AdGroupCriterion.Type>
</entries>
<entries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="BiddableAdGroupCriterion">
<adGroupId>14859103333</adGroupId>
<criterionUse>BIDDABLE</criterionUse>
<criterion xsi:type="ProductPartition">
<id>77691651733</id>
<type>PRODUCT_PARTITION</type>
<Criterion.Type>ProductPartition</Criterion.Type>
</criterion>
<AdGroupCriterion.Type>BiddableAdGroupCriterion</AdGroupCriterion.Type>
</entries>
</rval>
</getResponse>
</soap:Body>
</soap:Envelope>
[Jun 16 2014 13:43:00.000000 - ERROR] POST
/api/adwords/cm/v201402/AdGroupCriterionService?access_token=ya29.LgCcQe5M51OPZSAAAABnD_3qZI337w1eNnLB7Fp4Byl7C_1tLXQ2rViHI7RzcQ
HTTP/1.1
Host: adwords.google.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.3.3-7+squeeze19, gzip
Accept-Encoding: gzip, deflate
Content-Encoding: gzip
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 456
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201402">
<SOAP-ENV:Header>
<ns1:RequestHeader>
<ns1:clientCustomerId>XXX-XXX-XXXX</ns1:clientCustomerId>
<ns1:developerToken>XXXXXX</ns1:developerToken>
<ns1:userAgent>[email protected] (AwApi-PHP/5.2.1, Common-PHP/5.2.1,
PHP/5.3.3-7+squeeze19)</ns1:userAgent>
</ns1:RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:mutate>
<ns1:operations>
<ns1:operator>REMOVE</ns1:operator>
<ns1:operand>
<ns1:adGroupId>14859103333</ns1:adGroupId>
<ns1:criterion>
<ns1:id>18283950120</ns1:id>
</ns1:criterion>
</ns1:operand>
</ns1:operations>
<ns1:operations>
<ns1:operator>REMOVE</ns1:operator>
<ns1:operand>
<ns1:adGroupId>14859103333</ns1:adGroupId>
<ns1:criterion>
<ns1:id>77400162253</ns1:id>
</ns1:criterion>
</ns1:operand>
</ns1:operations>
<ns1:operations>
<ns1:operator>REMOVE</ns1:operator>
<ns1:operand>
<ns1:adGroupId>14859103333</ns1:adGroupId>
<ns1:criterion>
<ns1:id>77691651733</ns1:id>
</ns1:criterion>
</ns1:operand>
</ns1:operations>
</ns1:mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=UTF-8
Content-Encoding: gzip
Date: Mon, 16 Jun 2014 12:44:06 GMT
Expires: Mon, 16 Jun 2014 12:44:06 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 544
Server: GSE
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201402">
<requestId>0004fbf361ff52300a8083557f001174</requestId>
<serviceName>AdGroupCriterionService</serviceName>
<methodName>mutate</methodName>
<operations>3</operations>
<responseTime>343</responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @
operations[1].operand.criterion.id,
AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @
operations[2].operand.criterion.id]</faultstring>
<detail>
<ApiExceptionFault
xmlns="https://adwords.google.com/api/adwords/cm/v201402">
<message>[AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @
operations[1].operand.criterion.id,
AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @
operations[2].operand.criterion.id]</message>
<ApplicationException.Type>ApiException</ApplicationException.Type>
<errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AdGroupCriterionError">
<fieldPath>operations[1].operand.criterion.id</fieldPath>
<trigger/>
<errorString>AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST</errorString>
<ApiError.Type>AdGroupCriterionError</ApiError.Type>
<reason>PRODUCT_PARTITION_DOES_NOT_EXIST</reason>
</errors>
<errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AdGroupCriterionError">
<fieldPath>operations[2].operand.criterion.id</fieldPath>
<trigger/>
<errorString>AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST</errorString>
<ApiError.Type>AdGroupCriterionError</ApiError.Type>
<reason>PRODUCT_PARTITION_DOES_NOT_EXIST</reason>
</errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>