Hi, For issue #1, the error you are encountering means that the $clientId you are passing here:
$alertQuery->clientCustomerIds = array($clientId); Is either: a) Not an existing AdWords customer ID, or b) Not an AdWords customer ID to which the request's OAuth credentials has access Regarding the second method, the AlertService only returns a subset of the alert types that you see in the UI. Which types of alerts are you seeing in the UI? Thanks, Josh, AdWords API Team On Thursday, August 28, 2014 9:54:06 AM UTC-4, Athlan wrote: > > Howdy, > > I have notices two issues related with googleads-php-lib. > > 1. There is no possibility to query alert service from php library > passing clientId, because exception is thrown (in response you can notice > clientId = 0 - why?). > 2. There is no possibility to query alert service from MCC account > with customers, that authorized the app via OAuth2. > > > I have an app that authorizes users via OAuth2 and uses MCC's user > developer key. Everyone who allows application to get into their data, > allows to generate on-demand reports, browse the ads configuration etc. But > in AlertService there is no entries. The example > <https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201406/AccountManagement/GetAccountAlerts.php> > > also returns no entries. My code: > > $ADWORDS_VERSION = 'v201406'; > // Get the service, which loads the required classes. > $service = $client->GetService('AlertService', $ADWORDS_VERSION); > > > $clientId = (int) 'ClientIdWithoutDashes'; > //$clientId = 'ClientIdWithoutDashes'; // i have tried this also... > > > $alertQuery = new \AlertQuery(); > $alertQuery->clientSpec = "ID_LIST"; > $alertQuery->clientCustomerIds = array($clientId); > $alertQuery->filterSpec = 'ALL'; > $alertQuery->types = array('ACCOUNT_BUDGET_BURN_RATE', > 'ACCOUNT_BUDGET_ENDING', > 'ACCOUNT_ON_TARGET','CAMPAIGN_ENDED','CAMPAIGN_ENDING', > 'CREDIT_CARD_EXPIRING','DECLINED_PAYMENT', > 'MANAGER_LINK_PENDING','MISSING_BANK_REFERENCE_NUMBER', > 'PAYMENT_NOT_ENTERED','TV_ACCOUNT_BUDGET_ENDING', > 'TV_ACCOUNT_ON_TARGET', > 'TV_ZERO_DAILY_SPENDING_LIMIT','USER_INVITE_ACCEPTED', > 'USER_INVITE_PENDING','ZERO_DAILY_SPENDING_LIMIT'); > $alertQuery->severities = array('GREEN', 'YELLOW', 'RED'); > $alertQuery->triggerTimeSpec = 'ALL_TIME'; > > > // Create selector. > $selector = new \AlertSelector(); > $selector->query = $alertQuery; > > > // Create paging controls. > $selector->paging = new \Paging(0, \AdWordsConstants:: > RECOMMENDED_PAGE_SIZE;); > > > $result = []; > $i = 0; > > > do { > // Make the get request. > $page = $service->get($selector); > > // Display results. > if (isset($page->entries)) { > foreach ($page->entries as $entry) { > $result[] = $entry; > } > } else { > // No entries were found. > } > > // Advance the paging index. > $selector->paging->startIndex += $itemsPerPage; > } > while ($page->totalNumEntries > $selector->paging->startIndex); > > > return $result; > > I have tried passing $clientId as integer, as Paul Matthews (AdWords API > Team) written > <https://groups.google.com/d/msg/adwords-api/DRjtU7XSRMU/_Q7HfS0P8lkJ> > and as string with and without dashes. > > I am receiving exception: > [AlertError.INVALID_CLIENT_ID_SELECTED @ selector.query. > clientExternalCustomerIds[0]] > > In respons you can see that customerId is equal zero, while I have passed > an value... > > While I am using this method: > > $alertQuery = new \AlertQuery(); > $alertQuery->clientSpec = 'ALL'; > $alertQuery->filterSpec = 'ALL'; > $alertQuery->types = array('ACCOUNT_BUDGET_BURN_RATE', > 'ACCOUNT_BUDGET_ENDING', > 'ACCOUNT_ON_TARGET','CAMPAIGN_ENDED','CAMPAIGN_ENDING', > 'CREDIT_CARD_EXPIRING','DECLINED_PAYMENT', > 'MANAGER_LINK_PENDING','MISSING_BANK_REFERENCE_NUMBER', > 'PAYMENT_NOT_ENTERED','TV_ACCOUNT_BUDGET_ENDING', > 'TV_ACCOUNT_ON_TARGET', > 'TV_ZERO_DAILY_SPENDING_LIMIT','USER_INVITE_ACCEPTED', > 'USER_INVITE_PENDING','ZERO_DAILY_SPENDING_LIMIT'); > $alertQuery->severities = array('GREEN', 'YELLOW', 'RED'); > $alertQuery->triggerTimeSpec = 'ALL_TIME'; > > > I am receiving no alerts, while a few exists. > > I have also tried set customerId in client: > > $client->SetClientCustomerId( ... ); // as in reporting service, > wherethis method works > > What's going on? > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 [email protected]. 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/11c599ea-1ac6-4866-a476-d81dbe91eb6d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
