Hello!
I try to add some keywords to my ad group with AdWords API using PHP 
language.
When I run index.php file on my website, I'm getting next error message:
[SoapFault] 

[EntityNotFound.INVALID_ID @ operations[0].operand.adGroupId; 
trigger:'AdGroupId: 
16483195329'] (0) 

/var/www/html/www3.repka.com.ua/sources/repka/work/adwords/AdWordsApi/source
/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:232 

#0: SoapClient->__soapCall(string, array, NULL, array, array) 

        /var/www/html/www3.repka.com.ua/sources/repka/work/adwords/
AdWordsApi/source/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php:232 

#1: AdsSoapClient->__soapCall(string, array) 

        /var/www/html/www3.repka.com.ua/sources/repka/work/adwords/
AdWordsApi/source/src/Google/Api/Ads/AdWords/v201409/AdGroupCriterionService
.php:9936 

#2: AdGroupCriterionService->mutate(array) 

        /var/www/html/www3.repka.com.ua/sources/repka/work/adwords/index.php
:207


I checked this AdGroupId and such id exists in AdWords. 

 Bellow You can see auth.ini and index.php files structure. 

*auth.ini file*
; Detailed descriptions of these properties can be found at:

; https://developers.google.com/adwords/api/docs/headers 

developerToken = "SXlGI-o1iZDFmm_8dRanPg" 
userAgent = "Repka.UA" 

; Uncomment clientCustomerId to make requests against a single AdWords 
account, 
; such as when you run the examples. 
; If you don't set it here, you can set the client customer ID dynamically: 
;  $user = new AdWordsUser(); 
;  $user->SetClientCustomerId(...); 

clientCustomerId = "455-360-4589" 

  

[OAUTH2] 

; If you do not have a client ID or secret, please create one of type 
; "installed application" in the Google API console: 
; https://cloud.google.com/console 
client_id = 
"365676296598-ia0m03mu62iqlpp1m6v9rsg0f5of6acs.apps.googleusercontent.com" 
client_secret = "nouHaSuT8iSycuMIU3Mg28lN" 

; If you already have a refresh token, enter it below. Otherwise run 
; GetRefreshToken.php. 

refresh_token = 
"1/Yy3Dnz_0SE8lA8an9tmWtLGGmtDW0-9Anr2_zY6nOxQMEudVrK5jSpoR30zcRFq6"


*index**.**php file*
$path = dirname(__FILE__) . '/AdWordsApi/source/src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path); 
require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php'; 

$adGroupId = 16483195329; 
$adGroupId = (float)$adGroupId; 
$user = new AdWordsUser(); 
$user->LogAll(); 

$adGroupCriterionService = $user->GetService('AdGroupCriterionService', 
'v201409'); 

// Create keyword criterion. 
$keyword = new Keyword(); 
$keyword->text = "hello world"; 
$keyword->matchType = 'BROAD'; 

// Create biddable ad group criterion. 
$adGroupCriterion = new BiddableAdGroupCriterion(); 
$adGroupCriterion->adGroupId = $adGroupId; 
$adGroupCriterion->criterion = $keyword; 

// Set additional settings (optional). 
$adGroupCriterion->userStatus = 'PAUSED'; 
$adGroupCriterion->destinationUrl = 
'https://repka.ua/noutbuki/asus-s301lp-s301lp-c1010h-92202/'; 
$adGroupCriteria[] = $adGroupCriterion; 

// Create operation. 
$operation = new AdGroupCriterionOperation(); 
$operation->operand = $adGroupCriterion; 
$operation->operator = 'ADD'; 
$operations[] = $operation; 

$result = $adGroupCriterionService->mutate($operations); 

// Display results. 
foreach ($result->value as $adGroupCriterion) { 
       printf("Keyword with text '%s', match type '%s', and ID '%s' was 
added.\n", 
       $adGroupCriterion->criterion->text, 
       $adGroupCriterion->criterion->matchType, 
       $adGroupCriterion->criterion->id);
}


Please help me to solve this problem. Thanks!

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/221ba8b0-11fa-47f5-9665-39e4b6aeb918%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to