Hi! Thanks for the answer! I tried to link an account with php AdWords api (v201309): Now the clientCustomerId is the id of the client, and the managerCustomerId = $this->user->GetClientCustomerId(); $this->user is the user of my MCC account. ( Like in the examples $user )
The code is: // $data is prevalidated data from post. private function linkingUser( & $data ) { // Get the service, which loads the required classes. $managedCustomerService = $this->user->GetService('ManagedCustomerService', ADWORDS_VERSION); $link = new ManagedCustomerLink(); $link->clientCustomerId = $data["clientId"]; //CLIENT_CID; $link->pendingDescriptiveName = "PENDING: " . $data["clientId"]; $link->linkStatus = 'PENDING'; $link->managerCustomerId = $this->user->GetClientCustomerId(); //MANAGER_CID; // Create operation. $operation = new LinkOperation(); $operation->operand = $link; $operation->operator = 'ADD'; $operations = array( $operation ); try { // Make the mutate request. $result = $managedCustomerService->mutate( $operations ); } catch (Exception $e) { $message = $e->getMessage(); $this->errors[] = $message; return FALSE; } if( empty( $result->value[0] ) ) { $error = "Linking failed (garfx)." ; $this->errors[] = $error; return FALSE; } return $result->value[0]; } Probleme 1.) The result from "catch" section is: {"error" : "unauthorized_client"} Probleme 2.) curl probleme in API: Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in /var/www/vhosts/grafxsoftware.com/httpdocs/gapi/src/Google/Api/Ads/Common/Util/CurlUtils.php on line 107 Thanks for helping. Grafx. ----------------------------------------------------------------------------------------------------------------- On Friday, May 23, 2014 4:15:49 PM UTC+3, sup...@grafxsoftware.com wrote: > > Hi! > > I tried to link an account with this code in php AdWords api: > > private function linkingUser( & $data ) > { > > // Get the service, which loads the required classes. > $managedCustomerService = > $this->user->GetService('ManagedCustomerService', > ADWORDS_VERSION); > > > $link = new ManagedCustomerLink(); > $link->clientCustomerId = $data["googleClientId"];//CLIENT_CID; > $link->pendingDescriptiveName = ""; > $link->linkStatus = 'PENDING'; > $link->managerCustomerId = $data["googleClientId"];//MANAGER_CID; > > // Create operation. > $operation2 = new LinkOperation(); > > $operation2->operand = $link; > $operation2->operator = 'ADD'; > > $operations = array( $operation2); > > > > try > { > // Make the mutate request. > $result = $managedCustomerService->mutate( $operations ); > } > catch (Exception $e) { > $this->errors[] = $this->parseAdWordsError( $e->getMessage() ); > return FALSE; > } > > > if( empty( $result->value[0] ) ) > { > $error = "AdWordsUser not created (garfx)." ; > $this->errors[] = $error; > return FALSE; > } > > return $result->value[0]; > } > > The response was: > > [RequiredError.REQUIRED @ operations[0].operand.customerCurrencyCode, > RequiredError.REQUIRED @ operations[0].operand.clientName, > RequiredError.REQUIRED @ operations[0].operand.dateTimeZone] > > Please help me. What is wrong with my code? > > Thx. > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords 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 "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.