[PHP] mutateCustomerManagerLink PERMISSION_DENIED

78 views
Skip to first unread message

Artem Konyukhov

unread,
Dec 29, 2020, 12:42:40 PM12/29/20
to AdWords API and Google Ads API Forum
Hi,
I have got customer (MMC user).
It user has СustomerClientLinks:
Array
(
    [0] => Array
        (
            [customer_client_link.client_customer] => 9083557029
            [customer_client_link.resource_name] => customers/5817238941/customerClientLinks/9083557029~109349480
            [customer_client_link.manager_link_id] => 109349480
            [customer_client_link.status] => 2
        )
)

I want link CustomerClientLink to the CustomerManagerLink.
And I use this documentation.

When I make this part of code:

    $clientCustomerId = 9083557029;
    $managerCustomerId = 5817238941;
    $managerLinkId = 109349480;

    $managerLinkResourceName = ResourceNames::forCustomerManagerLink(
        $clientCustomerId,
        $managerCustomerId,
        $managerLinkId
    );


    $customerManagerLink = new CustomerManagerLink();
    $customerManagerLink->setResourceName($managerLinkResourceName);
    $customerManagerLink->setStatus(ManagerLinkStatus::ACTIVE);

    // Creates a customer manager link operation for updating the one above.
    $customerManagerLinkOperation = new CustomerManagerLinkOperation();
    $customerManagerLinkOperation->setUpdate($customerManagerLink);
    $customerManagerLinkOperation->setUpdateMask(
        FieldMasks::allSetFieldsOf($customerManagerLink)
    );

    // Issues a mutate request to update the customer manager link.
    $customerManagerLinkServiceClient =
        $googleAdsClient->getCustomerManagerLinkServiceClient();
    $response = $customerManagerLinkServiceClient->mutateCustomerManagerLink(
        $clientCustomerId,
        [$customerManagerLinkOperation]
    );


I get an error:

 
{
    "message": "The caller does not have permission",
    "code": 7,
    "status": "PERMISSION_DENIED",
    "details": [
        {
            "@type": "google.ads.googleads.v6.errors.googleadsfailure-bin",
            "data": ""
        },
        {
            "@type": "grpc-status-details-bin",
            "data": ""
        },
        {
            "@type": "request-id",
            "data": "zgAosgg3N0huFEThOf8_wA"
        }
    ]
}

Google Ads API Forum Advisor Prod

unread,
Dec 30, 2020, 12:46:43 PM12/30/20
to aar...@gmail.com, adwor...@googlegroups.com

Hi Artem, 

Thank you for reaching out. By checking your accounts I’m seeing that account 9083557029 is already a child account of 5817238941. Please try to link accounts that are not linked yet.

Thanks and regards,
Xiaoming, Google Ads API Team

 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AFqaX:ref

Artem Konyukhov

unread,
Jan 3, 2021, 4:15:07 PM1/3/21
to AdWords API and Google Ads API Forum
I want to link СustomerClientLinks to CustomerManagerLink
and see accounts when I request list CustomerManagerLink

But now, when I link СustomerClientLinks to CustomerManagerLink I got error, which I was described upper.
So, what I do wrong when try to link СustomerClientLinks to CustomerManagerLink ?

Thx!
среда, 30 декабря 2020 г. в 19:46:43 UTC+2, adsapiforumadvisor:

Google Ads API Forum Advisor Prod

unread,
Jan 4, 2021, 1:25:58 AM1/4/21
to aar...@gmail.com, adwor...@googlegroups.com
Hi Artem,

The PERMISSION_DENIED error may also indicate that your credentials may not have permission to the customer specified in your request header, as also described here.

That said, if you haven't yet, could you enable logging and provide to us the complete request and response logs, along with the request ID? The logs would help our team better identify the cause of the issue you are encountering.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AFqaX:ref

Artem Konyukhov

unread,
Jan 4, 2021, 5:25:36 AM1/4/21
to AdWords API and Google Ads API Forum
Hi Peter,
thx for your answer!

I enable logging and get new details. 
But I don't understand, what addition scope I need or what I need enable.

Details from log:

Array
(
    [0] => Array
        (
            [0] => NOTICE
            [1] => Request
-------
Method Name: /google.ads.googleads.v6.services.CustomerManagerLinkService/MutateCustomerManagerLink
Headers: {
    "x-goog-api-client": "gl-php\/7.2.21 gapic\/ gax\/1.6.0 grpc\/1.31.0",
    "x-goog-request-params": "customer_id=9083557029",
    "developer-token": "REDACTED",
    "login-customer-id": "9083557029"
}
Request:
{"customerId":"9083557029","operations":[{"updateMask":"resourceName,status","update":{"resourceName":"customers\/9083557029\/customerManagerLinks\/5817238941~109349480","status":"ACTIVE"}}]}

Response
-------
Headers: {
    "request-id": "TDhjyyq2xgMI4KSjZnyQPA",
    "date": "Mon, 04 Jan 2021 07:52:55 GMT",
    "alt-svc": "h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
}

Fault
-------
Status code: 7
Details: The caller does not have permission
Failure: {"errors":[{"errorCode":{"authorizationError":"CUSTOMER_NOT_ENABLED"},"message":"The customer can't be used because it isn't enabled."}]}
            [2] => Array
                (
                )

        )

)



понедельник, 4 января 2021 г. в 08:25:58 UTC+2, adsapiforumadvisor:

Google Ads API Forum Advisor Prod

unread,
Jan 4, 2021, 3:33:39 PM1/4/21
to aar...@gmail.com, adwor...@googlegroups.com

Hi Artem, 

Thank you for reaching out. There are two issues in your case. The first issue is that the client account 9083557029 is cancelled so that the "CUSTOMER_NOT_ENABLED" error occurred. The second issue is that 5817238941 is already a parent account for account 9083557029, and hence there is no need to accept the invitation.

Thanks and regards,
Xiaoming, Google Ads API Team



Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AFqaX:ref
Reply all
Reply to author
Forward
0 new messages