Manage the relationship between accounts

151 views
Skip to first unread message

Непомнющий Александр

unread,
Mar 26, 2019, 4:59:30 PM3/26/19
to AdWords API and Google Ads API Forum
Hi,
How to do it in the new version of google ads api v1 (Client library php) ? No information in the documentation or I looked bad. It is necessary to allow the Google account manager account to make changes to the account of another user. 
So, I need to manage the relationship between accounts. Please help with this question.  Thank

googleadsapi...@google.com

unread,
Mar 27, 2019, 3:57:36 AM3/27/19
to AdWords API and Google Ads API Forum
Hi,

Thank you for reaching out. To be able to manage relationship between accounts, you could check CustomerManagerLinkService and use MutateCustomerManagerLink method in managing the relationship between manager and customer.

Let me know if this answers your concern. Should you have further clarifications, feel free to write back.


Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@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+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/a3a00fa9-42c1-497e-add7-1d12f9cb33da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Непомнющий Александр

unread,
Apr 9, 2019, 6:06:19 PM4/9/19
to AdWords API and Google Ads API Forum
Hello,
thank you for answer. Very little information. Could you point to a sample code?

среда, 27 марта 2019 г., 8:57:36 UTC+1 пользователь googleadsapi-forumadvisor написал:

googleadsapi...@google.com

unread,
Apr 10, 2019, 1:55:11 AM4/10/19
to AdWords API and Google Ads API Forum
Hi,

To further investigate this, could you confirm if you will still encounter the error when you try to run other Google Ads API service? If yes, could you provide the complete JSON request and response logs when you encountered the error? If you haven't enabled logging yet, you could enable it by following this guide.

Moving forward, I may not provide you a sample code in PHP. I can only point you to the documentation that you might be able to use regarding your concern.


Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Непомнющий Александр

unread,
Apr 10, 2019, 8:51:40 AM4/10/19
to AdWords API and Google Ads API Forum
Hello Dave,

I'm trying to use  code to link Adwords accounts. I get 500 error from server. 

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

use GetOpt\GetOpt;
use Google\Auth\CredentialsLoader;
use Google\Auth\OAuth2;
use Psr\Http\Message\ServerRequestInterface;
use React\EventLoop\Factory;
use React\Http\Response;
use React\Http\Server;
use UnexpectedValueException;

use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\V1\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V1\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V1\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\V1\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V1\Services\GoogleAdsRow;
use Google\ApiCore\ApiException;
use Google\Ads\GoogleAds\V1\Resources\Customer;
use Google\Ads\GoogleAds\V1\Resources\CustomerManagerLink;


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

        // Construct a Google Ads client configured from a properties file and the
       // OAuth2 credentials above.
       $googleAdsClient = (new GoogleAdsClientBuilder())
           ->fromFile()
           ->withOAuth2Credential($oAuth2Credential)
           ->build();

$customerId = "1234112123";  /* Example */

$customerClientLinkServiceClient = $googleAdsClient->getCustomerClientLinkServiceClient();

$customerClientLink = new CustomerClientLink([
                                         "client_customer" => new StringValue(['value' => $customerId]),
                                         "status"                  => ManagerLinkStatus::PENDING
                                        ]);


If I remove a piece of code, then there is no error 500

$customerClientLink = new CustomerClientLink([
                                         "client_customer" => new StringValue(['value' => $customerId]),
                                         "status"                  => ManagerLinkStatus::PENDING
                                        ]);

I think the problem is with new CustomerClientLink. 

[LOGGING]
; Optional logging settings.
logFilePath = "/xxx/xxx/xxxxx/xxxxxx.xx/xxxxx/google-ads/file.log"
logLevel = "INFO"

file.log is empty. 



среда, 10 апреля 2019 г., 7:55:11 UTC+2 пользователь googleadsapi-forumadvisor написал:

googleadsapi...@google.com

unread,
Apr 11, 2019, 2:26:54 AM4/11/19
to AdWords API and Google Ads API Forum
Hi,

Upon checking, the error that you are encountering seems to be related more to the client library. You can reach out to the php client library owners through this link in Github as they are better equipped to assist you for this matter.

Regards,
Dave Paurillo
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

javoeria

unread,
Apr 11, 2019, 9:41:01 AM4/11/19
to AdWords API and Google Ads API Forum
Hi, i use the ruby library and i also can not link accounts with the new API, looks like the ManagerCustomerLink service has problems.
I agree that an example in all client libraries can be useful.
Thanks.

googleadsapi...@google.com

unread,
Apr 12, 2019, 2:40:39 AM4/12/19
to AdWords API and Google Ads API Forum
Hi,

I am a colleague of Dave, allow me to provide assistance for your concerns. Could you confirm if you are also encountering the 500 error issue? If yes, I would suggest to open your concern in the Ruby Github Issue tracker as the client library owners are better equipped in answering your concerns. At the same time, I will file a feature request on your behalf to add sample codes of different languages in the Google Ads API documentation.

If you are encountering a different issue, could you provide the JSON request and response logs via reply privately to author so I could further investigate this?

Regards,
Dannison
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Непомнющий Александр

unread,
Apr 12, 2019, 6:16:38 AM4/12/19
to AdWords API and Google Ads API Forum

Hi Dennison, I'm trying to link accounts with API PHP v201809.

namespace Google\AdsApi\Examples\AdWords\v201809\AccountManagement;

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

use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSession;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
use Google\AdsApi\AdWords\v201809\cm\Selector;
use Google\AdsApi\AdWords\v201809\cm\Predicate;
use Google\AdsApi\AdWords\v201809\cm\Operator;
use Google\AdsApi\AdWords\v201809\mcm\CustomerService;
use Google\AdsApi\AdWords\v201809\mcm\ServiceLink;
use Google\AdsApi\AdWords\v201809\mcm\ServiceLinkLinkStatus;
use Google\AdsApi\AdWords\v201809\mcm\ServiceLinkOperation;
use Google\AdsApi\AdWords\v201809\mcm\ServiceType;
use Google\AdsApi\Common\OAuth2TokenBuilder;


        // Generate a refreshable OAuth2 credential for authentication.
        $oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();

        // Construct an API session configured from a properties file and the
        // OAuth2 credentials above.
        $session = (new AdWordsSessionBuilder())->fromFile()->withOAuth2Credential($oAuth2Credential)->build();
$adWordsServices = new AdWordsServices();

$customerService = $adWordsServices->get($session, CustomerService::class);

$serviceLinkId = "xxx-xxx-xxxx";

// Create service link.
$serviceLink = new ServiceLink();
$serviceLink->setServiceLinkId($serviceLinkId);
$serviceLink->setServiceType(ServiceType::UNKNOWN);
$serviceLink->setLinkStatus(ServiceLinkLinkStatus::ACTIVE);

// Create a service link operation and add it to the list.
$operations = [];
$operation = new ServiceLinkOperation();
$operation->setOperator(Operator::SET);
$operation->setOperand($serviceLink);
$operations[] = $operation;

// Accept service links on the server and print out some information about
// accepted service links.

$serviceLinks = $customerService->mutateServiceLinks($operations); // Gibt Fehler 500

I get 500 error and this is what's in the soap.log file

[2019-04-12 07:11:26] AW_SOAP.WARNING: clientCustomerId=yyy-yyy-yyyy operations=1 service=CustomerService method=mutateServiceLinks responseTime=257 requestId=0005865002d05c1c0a8585d6c1014cfd server=adwords.google.com isFault=1 faultMessage=[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro]  
[2019-04-12 07:11:26] AW_SOAP.NOTICE: POST /api/adwords/mcm/v201809/CustomerService?wsdl HTTP/1.1
Connection: close
User-Agent: PHP-SOAP/7.2.15-0ubuntu0.18.04.2
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 949
Authorization: REDACTED

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" xmlns:ns2="https://adwords.google.com/api/adwords/mcm/v201809"><SOAP-ENV:Header><ns2:RequestHeader><ns1:clientCustomerId>948-211-5893</ns1:clientCustomerId><ns1:developerToken>REDACTED</ns1:developerToken><ns1:userAgent>AdConnector (AwApi-PHP, googleads-php-lib/39.0.0, PHP/7.2.15-0ubuntu0.18.04.2)</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:partialFailure>false</ns1:partialFailure></ns2:RequestHeader></SOAP-ENV:Header><SOAP-ENV:Body><ns2:mutateServiceLinks><ns2:operations><ns1:operator>SET</ns1:operator><ns2:operand><ns2:serviceType>UNKNOWN</ns2:serviceType><ns2:serviceLinkId>550</ns2:serviceLinkId><ns2:linkStatus>ACTIVE</ns2:linkStatus></ns2:operand></ns2:operations></ns2:mutateServiceLinks></SOAP-ENV:Body></SOAP-ENV:Envelope>

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=UTF-8
Date: Fri, 12 Apr 2019 07:11:26 GMT
Expires: Fri, 12 Apr 2019 07:11:26 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39"
Accept-Ranges: none
Vary: Accept-Encoding
Connection: close

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Header><ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809" xmlns="https://adwords.google.com/api/adwords/mcm/v201809">
<ns2:requestId>0005865002d05c1c0a8585d6c1014cfd</ns2:requestId>
<ns2:serviceName>CustomerService</ns2:serviceName>
<ns2:methodName>mutateServiceLinks</ns2:methodName>
<ns2:operations>1</ns2:operations>
<ns2:responseTime>257</ns2:responseTime></ResponseHeader></soap:Header>
<soap:Body><soap:Fault><faultcode>soap:Server</faultcode>
<faultstring>[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.&lt;init&gt;(InternalApiErro]</faultstring>
<detail><ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/mcm/v201809" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809"><ns2:message>[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.&lt;init&gt;(InternalApiErro]</ns2:message><ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type><ns2:errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InternalApiError"><ns2:fieldPath></ns2:fieldPath>
<ns2:trigger></ns2:trigger>
<ns2:errorString>InternalApiError.UNEXPECTED_INTERNAL_API_ERROR</ns2:errorString>
<ns2:ApiError.Type>InternalApiError</ns2:ApiError.Type>
<ns2:reason>UNEXPECTED_INTERNAL_API_ERROR</ns2:reason></ns2:errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>
  



пятница, 12 апреля 2019 г., 8:40:39 UTC+2 пользователь googleadsapi-forumadvisor написал:

googleadsapi...@google.com

unread,
Apr 15, 2019, 2:20:52 AM4/15/19
to AdWords API and Google Ads API Forum
Hi,

The UNEXPECTED_INTERNAL_API_ERROR error message may occur if the service request is too big or possible due to a bug. It is advisable to wait for a few minutes before making the service call again. However, checking your SOAP logs, there seems to be nothing wrong with your service call. Could you confirm if you are encountering this error consistently? If yes, kindly let me know so I could have the team investigate this.

Regards,
Dannison
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Непомнющий Александр

unread,
Apr 15, 2019, 5:23:20 AM4/15/19
to AdWords API and Google Ads API Forum
Hello Dannison,
yes it still happens.

понедельник, 15 апреля 2019 г., 8:20:52 UTC+2 пользователь googleadsapi-forumadvisor написал:

googleadsapi...@google.com

unread,
Apr 15, 2019, 4:07:22 PM4/15/19
to aleks....@gmail.com, AdWords API and Google Ads API Forum
Hi,

I noticed that in the XML you provided, you are calling the CustomerService.mutateServiceLinks method, but the customer ID in your request returns no service links from CustomerService.getServiceLinks. Is your goal to link your Google Ads account with your Merchant Center account, or link child accounts to your manager account? If you're looking to link child accounts to your manager account, you'll want to use ManagedCustomerService.mutateLink instead, as described in our Managing Accounts guide.

Thanks,
Josh, Google Ads API Team
Reply all
Reply to author
Forward
0 new messages