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.