AdGroupCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand

270 views
Skip to first unread message

TommyTek

unread,
Feb 19, 2018, 4:27:36 AM2/19/18
to AdWords API Forum
Hello,
  I'm migrating to Adwords API 201710 and I'm getting this error:
GroupCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand

I'm using googleads-php-lib V 32.1

I've read forum about this error and usually it's associated to not properly setting AdGroupCriterion to BiddableAdGroupCriterion

In my case the error seems to be elsewhere and I'm not being able to find it.

This is the SOAP request:

<SOAP-ENV:Header>
<ns1:RequestHeader>
<ns1:clientCustomerId>xxx-xxx-xxx</ns1:clientCustomerId>
<ns1:developerToken>REDACTED</ns1:developerToken>
<ns1:userAgent>xxxxxxxxx (AwApi-PHP, googleads-php-lib/32.1.0, PHP/5.6.33)</ns1:userAgent>
<ns1:validateOnly>false</ns1:validateOnly>
<ns1:partialFailure>false</ns1:partialFailure>
</ns1:RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:mutate>
<ns1:operations>
<ns1:operator>ADD</ns1:operator>
<ns1:operand>
<ns1:adGroupId>53774068962</ns1:adGroupId>
<ns1:criterion xsi:type="ns1:Keyword">
<ns1:text>keyword 1</ns1:text>
<ns1:matchType>BROAD</ns1:matchType>
</ns1:criterion>
</ns1:operand>
</ns1:operations>
</ns1:mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

As you can see info about url and cpc are missing (while I set them in the code).


Here the SOAP response (not nicely formatted):

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header><ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201710">
<requestId>00056558587da1490ae9e852da0a77b9</requestId><serviceName>AdGroupCriterionService</serviceName><methodName>mutate</methodName><operations>1</operations>
<responseTime>379</responseTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>[AdGroupCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand]</faultstring>
<detail><ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201710"><message>[AdGroupCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand]</message>
<ApplicationException.Type>ApiException</ApplicationException.Type><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupCriterionError"><fieldPath>operations[0].operand</fieldPath><fieldPathElements><field>operations</field>
<index>0</index></fieldPathElements><fieldPathElements><field>operand</field></fieldPathElements><trigger></trigger><errorString>AdGroupCriterionError.CONCRETE_TYPE_REQUIRED</errorString><ApiError.Type>AdGroupCriterionError</ApiError.Type>
<reason>CONCRETE_TYPE_REQUIRED</reason></errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>


This is a dump of the $operation object before adding it to array $operators[] I pass to mutate  ( class type AdGroupCriterionService )

object(Google\AdsApi\AdWords\v201710\cm\AdGroupCriterionOperation)#12 (5) {
  ["operand":protected]=>
  object(Google\AdsApi\AdWords\v201702\cm\BiddableAdGroupCriterion)#47 (25) {
    ["userStatus":protected]=>
    string(7) "ENABLED"
    ["systemServingStatus":protected]=>
    NULL
    ["approvalStatus":protected]=>
    NULL
    ["disapprovalReasons":protected]=>
    NULL
    ["destinationUrl":protected]=>
    string(0) ""
    ["firstPageCpc":protected]=>
    NULL
    ["topOfPageCpc":protected]=>
    NULL
    ["firstPositionCpc":protected]=>
    NULL
    ["qualityInfo":protected]=>
    NULL
    ["biddingStrategyConfiguration":protected]=>
    object(Google\AdsApi\AdWords\v201710\cm\BiddingStrategyConfiguration)#25 (7)
 {
      ["biddingStrategyId":protected]=>
      NULL
      ["biddingStrategyName":protected]=>
      NULL
      ["biddingStrategyType":protected]=>
      NULL
      ["biddingStrategySource":protected]=>
      NULL
      ["biddingScheme":protected]=>
      NULL
      ["bids":protected]=>
      array(1) {
        [0]=>
        object(Google\AdsApi\AdWords\v201710\cm\CpcBid)#13 (4) {
          ["bid":protected]=>
          object(Google\AdsApi\AdWords\v201710\cm\Money)#29 (3) {
            ["microAmount":protected]=>
            int(30000)
            ["ComparableValueType":protected]=>
            NULL
            ["parameterMap":"Google\AdsApi\AdWords\v201710\cm\ComparableValue":private]=>
            array(1) {
              ["ComparableValue.Type"]=>
              string(19) "ComparableValueType"
            }
          }
          ["cpcBidSource":protected]=>
          NULL
          ["BidsType":protected]=>
          NULL
          ["parameterMap":"Google\AdsApi\AdWords\v201710\cm\Bids":private]=>
          array(1) {
            ["Bids.Type"]=>
            string(8) "BidsType"
          }
        }
      }
      ["targetRoasOverride":protected]=>
      NULL
    }
    ["bidModifier":protected]=>
    NULL
    ["finalUrls":protected]=>
    object(Google\AdsApi\AdWords\v201710\cm\UrlList)#24 (1) {
      ["urls":protected]=>
      array(1) {
        [0]=>
      }
    }
    ["finalMobileUrls":protected]=>
    NULL
    ["finalAppUrls":protected]=>
    NULL
    ["trackingUrlTemplate":protected]=>
    NULL
    ["urlCustomParameters":protected]=>
    NULL
    ["adGroupId":protected]=>
    float(53774068962)
    ["criterionUse":protected]=>
    NULL
    ["criterion":protected]=>
    object(Google\AdsApi\AdWords\v201710\cm\Keyword)#59 (6) {
      ["text":protected]=>
      string(9) "keyword 1"
      ["matchType":protected]=>
      string(5) "BROAD"
      ["id":protected]=>
      NULL
      ["type":protected]=>
      NULL
      ["CriterionType":protected]=>
      NULL
      ["parameterMap":"Google\AdsApi\AdWords\v201710\cm\Criterion":private]=>
      array(1) {
        ["Criterion.Type"]=>
        string(13) "CriterionType"
      }
    }
    ["labels":protected]=>
    NULL
    ["forwardCompatibilityMap":protected]=>
    NULL
    ["baseCampaignId":protected]=>
    NULL
    ["baseAdGroupId":protected]=>
    NULL
    ["AdGroupCriterionType":protected]=>
    NULL
    ["parameterMap":"Google\AdsApi\AdWords\v201702\cm\AdGroupCriterion":private]
=>
    array(1) {
      ["AdGroupCriterion.Type"]=>
      string(20) "AdGroupCriterionType"
    }
  }
  ["exemptionRequests":protected]=>
  NULL
  ["operator":protected]=>
  string(3) "ADD"
  ["OperationType":protected]=>
  NULL
  ["parameterMap":"Google\AdsApi\AdWords\v201710\cm\Operation":private]=>
  array(1) {
    ["Operation.Type"]=>
    string(13) "OperationType"
  }
}


Is someone able to see what I'm doing wrong? I'm looking at https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201710/BasicOperations/AddKeywords.php and I don't see differences (but surely I'm blind after 4 hours of tests)

Thank you!

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Feb 19, 2018, 2:13:51 PM2/19/18
to AdWords API Forum
Hi, 

From the SOAP logs, it looks like the namespace for BiddableAdGroupCriterion is missing in your request resulting in the CONCRETE_TYPE_REQUIRED error. I see that you were looking up the sample in PHP for reference. Could you also confirm if you are using the PHP client library or just using them as reference? Below is the snippet of a successful request to ADD a keyword. I see that your trace of the request has the bid and the finalUrl but that is missing in the SOAP request. Could you share your code snippet used to add the keywords?

            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201710" xsi:type="ns2:BiddableAdGroupCriterion">
                    <ns2:adGroupId>*****</ns2:adGroupId>
                    <ns2:criterion xsi:type="ns2:Keyword">
                        <ns2:text>mars cruise</ns2:text>
                        <ns2:matchType>BROAD</ns2:matchType>
                    </ns2:criterion>
                    <ns2:biddingStrategyConfiguration>
                        <ns2:bids xsi:type="ns2:CpcBid">
                            <ns2:bid>
                                <ns2:microAmount>10000000</ns2:microAmount>
                            </ns2:bid>
                        </ns2:bids>
                    </ns2:biddingStrategyConfiguration>
                    <ns2:finalUrls>
                        <ns2:urls>http://example.com/mars/cruise/?kw=mars+cruise</ns2:urls>
                    </ns2:finalUrls>
                </operand>
            </operations>

Thanks,
Sreelakshmi, AdWords API Team.
Message has been deleted

TommyTek

unread,
Feb 20, 2018, 6:16:01 AM2/20/18
to AdWords API Forum
Hi,
 yes, it seems that the namespace is missing, but if you look at the php dump you can see that it's there in the first lines.

I'm using the examples as reference; here in short the phpcode I'm using:

$operations = array();

            
$keyword = new Keyword();
$keyword->setText($myKeyword->keywordText);
$keyword->setMatchType($myKeyword->matchType);
        
if( $myKeyword->isNegative() === false ) {
        
$adGroupCriterion = new BiddableAdGroupCriterion();

if( $myKeyword->maxCpc != 0 ) { 
    $bid = new CpcBid();
    
    $money = new Money();
    $money->setMicroAmount($myKeyword->maxCpc * _API_GOOGLE_MONEY_DIVISOR);
    $bid->setBid($money);
    
    $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
    $biddingStrategyConfiguration->setBids(array($bid));
    
    $adGroupCriterion->setBiddingStrategyConfiguration($biddingStrategyConfiguration);
}

if( $myKeyword->url != '' ) {
    $adGroupCriterion->setDestinationUrl('');
    $adGroupCriterion->setFinalUrls(new UrlList(array( $myKeyword->url )));                    
}                    

$adGroupCriterion->setUserStatus($myKeyword->onlineStatus);              

} else {
  //negative keyword
  $adGroupCriterion = new NegativeAdGroupCriterion();
}

$adGroupCriterion->setAdGroupId((double) $myKeyword->adgroudId); 
$adGroupCriterion->setCriterion($keyword); 
            
$operation = new AdGroupCriterionOperation();
if( $exemptionKey !== false )
$operation->setExemptionRequests(array(new ExemptionRequest( $exemptionKey )));    
$operation->setOperand($adGroupCriterion);
$operation->setOperator('ADD'); 

 
var_dump($operation);
 
$operations[] = $operation;

$APIresult = $servizio->mutate( $operations );

Thank you for the help!

TommyTek

unread,
Feb 20, 2018, 9:25:04 AM2/20/18
to AdWords API Forum
Hi,
  I've found and solved the issue.

The problem was with an "use" statament. I'm using 201710 version, but unbeliavable the I was using 201702 for BiddableAdGroupCriterion
use Google\AdsApi\AdWords\v201702\cm\BiddableAdGroupCriterion;

The result was that compiler and library were not complaining, but the object was not translated properly

Thank you for the support

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Feb 20, 2018, 1:17:31 PM2/20/18
to AdWords API Forum
Hi, 

Thanks for the update! Glad that you were able to resolve the issue. 
Reply all
Reply to author
Forward
0 new messages