Hello,

When I call the Google Ads API(V2) to create an AdGroupAd, throw an error 
about “This operation is not permitted on this campaign type” .[image: 
1565602956447.jpg]

before this,I have set the Campaign 
advertising_channel_type=MULTI_CHANNEL,advertising_channel_sub_type=APP_CAMPAIGN,AdGroup
 
type=UNSPECIFIED.


and here is my code about create AdGroupAd:

public static function runExample(
        GoogleAdsClient $googleAdsClient,
        $customerId,
        $adGroupId
    ) {
        $adGroupResourceName = new StringValue(['value' => 
ResourceNames::forAdGroup($customerId, $adGroupId)]);

        $asset_operations = [];
        $ad_operations = [];

        $asset = new Asset([
            'youtube_video_asset' => new YoutubeVideoAsset([
                'youtube_video_id' => new StringValue(['value' => 
'adZeOuXpqIQ'])
            ]),
            'type' => AssetType::YOUTUBE_VIDEO,
        ]);
        $assetOperation = new AssetOperation();
        $assetOperation->setCreate($asset);
        $asset_operations[] = $assetOperation;

        $assetServiceClient = $googleAdsClient->getAssetServiceClient();
        $response = 
$assetServiceClient->mutateAssets($customerId,$asset_operations);
        foreach ($response->getResults() as $asset) {
            $assetResourceName = $asset->getResourceName();
        }

        $appAdInfo = new AppAdInfo([
            'youtube_videos'=>[
                new AdVideoAsset([
                    'asset'=>new StringValue(['value' => 
$assetResourceName]),
                ])
            ],
        ]);

        //Sets the expanded text ad info on an Ad.
        $ad = new Ad([
            'type'=>AdType::APP_AD,
            'app_ad'=>$appAdInfo,
        ]);

        // Creates an ad group ad to hold the above ad.
        $adGroupAd = new AdGroupAd([
            'ad_group' => $adGroupResourceName,
            'status' => AdGroupAdStatus::PAUSED,
            'ad'=>$ad,
        ]);

        // Creates an ad group ad operation and add it to the operations 
array.
        $adGroupAdOperation = new AdGroupAdOperation();
        $adGroupAdOperation->setCreate($adGroupAd);
        $ad_operations[] = $adGroupAdOperation;

        // Issues a mutate request to add the ad group ads.
        $adGroupAdServiceClient = 
$googleAdsClient->getAdGroupAdServiceClient();
        $response = $adGroupAdServiceClient->mutateAdGroupAds($customerId, 
$ad_operations);
        foreach ($response->getResults() as $addedAdGroupAd) {
            /** @var AdGroupAd $addedAdGroupAd */
            printf(
                "Expanded text ad was created with resource name: '%s'%s",
                $addedAdGroupAd->getResourceName(),
                PHP_EOL
            );
        }
    }

}



How to solve this problem? 

Thank you

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/b7cf1599-b42f-472b-8f7d-c776f2a06547%40googlegroups.com.

Reply via email to