*Hi,We used the following code for V11 and it ran perfectly,*

<?php

namespace Google\Ads\GoogleAds\Examples\AccountManagement;

require __DIR__ . '/vendor/autoload.php';

use GetOpt\GetOpt;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\Lib\V13\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V13\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V13\GoogleAdsException;
use Google\Ads\GoogleAds\Util\FieldMasks;
use Google\Ads\GoogleAds\Util\V13\ResourceNames;
use Google\Ads\GoogleAds\V13\Enums\ManagerLinkStatusEnum\ManagerLinkStatus;
use Google\Ads\GoogleAds\V13\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V13\Resources\CustomerClientLink;
use Google\Ads\GoogleAds\V13\Resources\CustomerManagerLink;
use Google\Ads\GoogleAds\V13\Services\CustomerClientLinkOperation;
use Google\Ads\GoogleAds\V13\Services\CustomerManagerLinkOperation;
use Google\ApiCore\ApiException;

try {
    $oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();
    $googleAdsClient = (new GoogleAdsClientBuilder())->fromFile()->
withOAuth2Credential($oAuth2Credential)->build();

    $customerClientLink = new CustomerClientLink([
        'client_customer' => ResourceNames::forCustomer($this_customerId),
        'status' => ManagerLinkStatus::UNSPECIFIED
    ]);

    $customerClientLinkOperation = new CustomerClientLinkOperation();
    $customerClientLinkOperation->setCreate($customerClientLink);

    $customerClientLinkServiceClient = $googleAdsClient->
getCustomerClientLinkServiceClient();
    try {
        $response = $customerClientLinkServiceClient->
mutateCustomerClientLink(MANAGER_CUSTOMER_ID, $customerClientLinkOperation);


        $customerClientLinkResourceName = $response->getResult()->
getResourceName();
    } catch (GoogleAdsException $e) {
        printf(
            "Request with ID '%s' has failed.%sGoogle Ads failure 
details:%s",
            $e->getRequestId(),
            PHP_EOL,
            PHP_EOL
        );
        foreach ($e->getGoogleAdsFailure()->getErrors() as $error) {
            /** @var GoogleAdsError $error */
            printf(
                "\t%s: %s%s",
                $error->getErrorCode()->getErrorCode(),
                $error->getMessage(),
                PHP_EOL
            );
        }

    }
} catch (ApiException $e) {
    printf(
        "ApiException was thrown with message '%s'.%s",
        $e->getMessage(),
        PHP_EOL
    );

 
    print_r($e);
}


*And now we are in a process of upgrading it to V13 and its throwing the 
following error, can anyone help?* 
Google\ApiCore\ApiException Object
(
[status:Google\ApiCore\ApiException:private] => INVALID_ARGUMENT
[metadata:Google\ApiCore\ApiException:private] => Array
(
[0] => Array
(
[@type] => 
type.googleapis.com/google.ads.googleads.v13.errors.GoogleAdsFailure
[errors] => Array
 (
  [0] => Array
   (
    [errorCode] => Array
     (
      [managerLinkError] => INVALID_STATUS_CHANGE
     )

    [message] => The changed status for mutate link is invalid.
    [location] => Array
     (
      [fieldPathElements] => Array
       (
        [0] => Array
         (
          [fieldName] => operation
         )

       )

     )

   )

 )

[requestId] => zqj75KZrVSirR4Vm3FyNAw
)

)

*Thanks*

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords 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/27c90fa8-0680-49a2-8089-4a95a3c0febcn%40googlegroups.com.
  • Ca... Waz Anz
    • ... Waz Anz
      • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to