Hello Adword Team,

When we adding *mobile app install ad* under the 
SEARCH(advertisingChannelType) and 
SEARCH_MOBILE_APP(advertisingChannelSubType) we getting error like this
"OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ 
operations[0].operand.ad; trigger:'SEARCH(SEARCH_MOBILE_APP)". But it is 
fine adding under the 
DISPLAY (advertisingChannelType) and DISPLAY_MOBILE_APP 
(advertisingChannelSubType). How can we add mobile app install ad under 
search campaign?

This is the code we are using to ad

function addMobileEngagement($groupId, $appStoreText, $headlineText, 
$description1Text, $description2Text, $lookupId, $scheme, $hostPath, 
$devicePreference){
$adGroupAdServiceMobile = $this->GetService('AdGroupAdService', 
ADWORDS_VERSION);
// Create the template ad.
$appEngagementAd = new TemplateAd();
if($appStoreText == 'appstore'){
$appEngagementAd->displayUrl = "itunes.apple.com";
}
else{
$appEngagementAd->displayUrl = "play.google.com";
}

$appEngagementAd->name = $scheme;
$appEngagementAd->templateId = 453;
//$devicePreference = 30002;
if($devicePreference == 30002){
$appEngagementAd->devicePreference = 30001;
} 
if($appStoreText == 'appstore'){
$appEngagementAd->finalAppUrls = new AppUrl();
$appEngagementAd->finalAppUrls->url = 
"ios-app://".$lookupId."/".$scheme."/".$hostPath."";  
$appEngagementAd->finalAppUrls->osType = "OS_TYPE_IOS"; 
}
else{
$appEngagementAd->finalAppUrls = new AppUrl();
$appEngagementAd->finalAppUrls->url = 
"android-app://".$lookupId."/".$scheme."/".$hostPath."";  
$appEngagementAd->finalAppUrls->osType = "OS_TYPE_ANDROID";  
}  

// Create the template elements for the ad. You can refer to
// https://developers.google.com/adwords/api/docs/appendix/templateads
// for the list of available template fields.
$headline = new TemplateElementField();
$headline->name = "headline";
$headline->fieldText = $headlineText;
$headline->type = "TEXT";

$description1 = new TemplateElementField();
$description1->name = "description1";
$description1->fieldText = $description1Text;
$description1->type = "TEXT";
$description2 = new TemplateElementField();
$description2->name = "description2";
$description2->fieldText = $description2Text;
$description2->type = "TEXT";

$appId = new TemplateElementField();
$appId->name = "appId";
$appId->fieldText = $lookupId;
$appId->type = "TEXT";

$appStore = new TemplateElementField();
$appStore->name = "appStore";
if($appStoreText == 'appstore'){
$appStore->fieldText = "1";
}
else{
$appStore->fieldText = "2";
}
$appStore->type = "ENUM";

$adData = new TemplateElement();
$adData->uniqueName = "adData";
$adData->fields = array($headline, $description1, $description2, $appId,
$appStore);

$appEngagementAd->templateElements = array($adData);
// Create ad group ad.
$adGroupAd = new AdGroupAd();
$adGroupAd->adGroupId = $groupId;
$adGroupAd->ad = $appEngagementAd;

// Set additional settings (optional).
$adGroupAd->status = 'ENABLED';

// Create operation.
$operation = new AdGroupAdOperation();
$operation->operand = $adGroupAd;
$operation->operator = 'ADD';
$operations = array($operation); 
// Make the mutate request.
$result = $adGroupAdServiceMobile->mutate($operations); 
return $result;
}
Correspong xml request and respose will be given below
[Jul 23 2015 06:45:18.000000 - ERROR] POST 
/api/adwords/cm/v201409/AdGroupAdService HTTP/1.1
Host: adwords.google.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.5.12, gzip
Accept-Encoding: gzip, deflate
Content-Encoding: gzip
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 738
Authorization: Bearer 
ya29.uQGJh3jWkV8VdOZnFlRqbxGY9he-FJMnGQ3B4cXwdu4Mu1w5ms5voQwOU_3X6YzWkD73

<?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/v201409"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <SOAP-ENV:Header>
    <ns1:RequestHeader>
      <ns1:clientCustomerId></ns1:clientCustomerId>
      <ns1:developerToken></ns1:developerToken>
      <ns1:userAgent>(AwApi-PHP/5.7.1, Common-PHP/5.7.1, 
PHP/5.5.12)</ns1:userAgent>
    </ns1:RequestHeader>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:mutate>
      <ns1:operations>
        <ns1:operator>ADD</ns1:operator>
        <ns1:operand>
          <ns1:adGroupId>22094150829</ns1:adGroupId>
          <ns1:ad xsi:type="ns1:TemplateAd">
            <ns1:displayUrl>play.google.com</ns1:displayUrl>
            <ns1:finalAppUrls>
              
<ns1:url>android-app://com.example.demogame/loadlevel?level=mars</ns1:url>
              <ns1:osType>OS_TYPE_ANDROID</ns1:osType>
            </ns1:finalAppUrls>
            <ns1:templateId>453</ns1:templateId>
            <ns1:templateElements>
              <ns1:uniqueName>adData</ns1:uniqueName>
              <ns1:fields>
                <ns1:name>headline</ns1:name>
                <ns1:type>TEXT</ns1:type>
                <ns1:fieldText>varun</ns1:fieldText>
              </ns1:fields>
              <ns1:fields>
                <ns1:name>description1</ns1:name>
                <ns1:type>TEXT</ns1:type>
                <ns1:fieldText>varun against players online</ns1:fieldText>
              </ns1:fields>
              <ns1:fields>
                <ns1:name>description2</ns1:name>
                <ns1:type>TEXT</ns1:type>
                <ns1:fieldText>cvit is against you</ns1:fieldText>
              </ns1:fields>
              <ns1:fields>
                <ns1:name>appId</ns1:name>
                <ns1:type>TEXT</ns1:type>
                <ns1:fieldText>com.example.demogame</ns1:fieldText>
              </ns1:fields>
              <ns1:fields>
                <ns1:name>appStore</ns1:name>
                <ns1:type>ENUM</ns1:type>
                <ns1:fieldText>2</ns1:fieldText>
              </ns1:fields>
            </ns1:templateElements>
            <ns1:name>Ad for demo game</ns1:name>
          </ns1:ad>
          <ns1:status>ENABLED</ns1:status>
        </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: Thu, 23 Jul 2015 04:45:24 GMT
Expires: Thu, 23 Jul 2015 04:45:24 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 559
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/v201409";>
      <requestId>00051b838e3430a00a4c53452f041628</requestId>
      <serviceName>AdGroupAdService</serviceName>
      <methodName>mutate</methodName>
      <operations>1</operations>
      <responseTime>129</responseTime>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      
<faultstring>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE 
@ operations[0].operand.ad; 
trigger:'SEARCH(SEARCH_MOBILE_APP)']</faultstring>
      <detail>
        <ApiExceptionFault 
xmlns="https://adwords.google.com/api/adwords/cm/v201409";>
          
<message>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ 
operations[0].operand.ad; trigger:'SEARCH(SEARCH_MOBILE_APP)']</message>
          
<ApplicationException.Type>ApiException</ApplicationException.Type>
          <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="OperationAccessDenied">
            <fieldPath>operations[0].operand.ad</fieldPath>
            <trigger>SEARCH(SEARCH_MOBILE_APP)</trigger>
            
<errorString>OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE</errorString>
            <ApiError.Type>OperationAccessDenied</ApiError.Type>
            <reason>OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE</reason>
          </errors>
        </ApiExceptionFault>
      </detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Thanks and Regards 
Sandeep cv

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/04df80d7-2eef-4e33-a7f2-124314441584%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to