Hi,

I want to revoke the invitation via API. My code is

$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();


$session = (new AdWordsSessionBuilder())->fromFile()->withOAuth2Credential(
$oAuth2Credential)->build();


$adWordsServices=new AdWordsServices();


$managedCustomerService = $adWordsServices->get($session, 
ManagedCustomerService::class);


$link = new ManagedCustomerLink();    
$link->setClientCustomerId($customerid);
$link->setLinkStatus(LinkStatus::CANCELLED);
$link->setManagerCustomerId(ADWORDS_MANAGER_ID);


$linkop = new LinkOperation();
$linkop->setOperand($link);
$linkop->setOperator(Operator::SET);    


$operations = array($linkop);


try{
 $result = $managedCustomerService->mutateLink($operations);
 print_r($result);
}catch(ApiException $e){
 print_r($e->getErrors());
}

But I'm receiving error.


Array
(
    [0] => Google\AdsApi\AdWords\v201809\mcm\ManagedCustomerServiceError 
Object
        (
            [reason:protected] => NO_PENDING_INVITATION
            [customerIds:protected] =>
            [fieldPath:protected] => operations[0]
            [fieldPathElements:protected] => Array
                (
                    [0] => Google\AdsApi\AdWords\v201809\cm\FieldPathElement
 Object
                        (
                            [field:protected] => operations
                            [index:protected] => 0
                        )


                )


            [trigger:protected] =>
            [errorString:protected] => ManagedCustomerServiceError.
NO_PENDING_INVITATION
            [ApiErrorType:protected] => ManagedCustomerServiceError
            [parameterMap:Google\AdsApi\AdWords\v201809\cm\ApiError:private]
 => Array
                (
                    [ApiError.Type] => ApiErrorType
                )


        )


)

And I'm sure there is pending link request which I can see in Sub-account 
settings.

P.S: I've checked
https://developers.google.com/adwords/api/docs/guides/accounts-overview#rescinding_invitations

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e3325365-b625-49af-940f-5dfbe1aa9bfbo%40googlegroups.com.

Reply via email to