PHP Client Library for v2009, EntityNotFound.INVALID_ID @ selector ERROR

23 views
Skip to first unread message

Eugene

unread,
Nov 17, 2009, 10:56:04 AM11/17/09
to AdWords API Forum
This code:

$infoService = $user->GetInfoService();
$is = new InfoSelector();
$is->dateRange = new DateRange(
date("Ymd", mktime(date("H"), date("i"), date("s"), date("m"), date
("d")-1, date("Y"))),
date("Ymd", mktime(date("H"), date("i"), date("s"), date("m"), date
("d")-1, date("Y")))
);
$is->apiUsageType = FREE_USAGE_API_UNITS_PER_MONTH;

$infoPage = $infoService->get($is);

results in:

Fatal error: Uncaught SoapFault exception: [soap:Server]
[EntityNotFound.INVALID_ID @ selector] in /var/www/tjs/lib/v2009/src/
Google/Api/Ads/Common/Lib/AdsSoapClient.php:160 Stack trace: #0 /var/
www/tjs/lib/v2009/src/Google/Api/Ads/Common/Lib/AdsSoapClient.php
(160): SoapClient->__soapCall('get', Array, NULL, NULL, Array) #1 /var/
www/tjs/lib/v2009/src/Google/Api/Ads/AdWords/v200909/info/
InfoService.php(1850): AdsSoapClient->__soapCall('get', Array) #2 /var/
www/tjs/user/stats.inc.php(41): InfoService->get(Object(InfoSelector))
#3 /var/www/tjs/index.php(30): require_once('/var/www/tjs/us...') #4
{main} thrown in /var/www/tjs/lib/v2009/src/Google/Api/Ads/Common/Lib/
AdsSoapClient.php on line 160

Any ideas?

AdWords API Advisor

unread,
Nov 17, 2009, 2:29:07 PM11/17/09
to AdWords API Forum
Hi Eugene,

One point is that when using the apiUsageType
"FREE_USAGE_API_UNITS_PER_MONTH" you should not specify a date range
( see http://code.google.com/apis/adwords/v2009/docs/reference/InfoService.InfoSelector.html
). I'm not sure if this the cause of your exception though. Do you
have the SOAP XML request and response from this request?

Best,
- Eric Koleda, AdWords API Team

Eugene

unread,
Nov 18, 2009, 3:31:50 AM11/18/09
to AdWords API Forum
Hi Eric,

I removed dates - no luck.

Request and response you asked:

<?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/info/
v200909" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v200909"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
<ns1:RequestHeader xsi:type="ns1:RequestHeader">
<ns2:applicationToken>xxxxxxxxxxxxxxxx</
ns2:applicationToken>
<ns2:authToken>xxxxxxxxxxxxxxx</ns2:authToken>
<ns2:developerToken>xxxxxxxxxxxxxxxxx</
ns2:developerToken>
<ns2:userAgent>AdWords API PHP Client LIbrary -
v1.1.0</ns2:userAgent>
</ns1:RequestHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:get xsi:type="get">
<ns1:selector xsi:type="ns1:InfoSelector">

<ns1:apiUsageType>FREE_USAGE_API_UNITS_PER_MONTH</ns1:apiUsageType>
</ns1:selector>
</ns1:get>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns:ns2="https://adwords.google.com/api/
adwords/cm/v200909" xmlns="https://adwords.google.com/api/adwords/info/
v200909">
<ns2:requestId>a7177f0e64a130dff6ce78a61e3f7923</
ns2:requestId>
<ns2:operations>1</ns2:operations>
<ns2:responseTime>3708</ns2:responseTime>
<ns2:units>1</ns2:units>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[EntityNotFound.INVALID_ID @ selector]</
faultstring>
<detail>
<ApiExceptionFault xmlns="https://
adwords.google.com/api/adwords/info/v200909" xmlns:ns2="https://
adwords.google.com/api/adwords/cm/v200909">
<ns2:message>[EntityNotFound.INVALID_ID
@ selector]</ns2:message>

<ns2:ApplicationException.Type>ApiException</
ns2:ApplicationException.Type>
<ns2:errors xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance" xsi:type="ns2:EntityNotFound">
<ns2:fieldPath>selector</
ns2:fieldPath>
<ns2:trigger></ns2:trigger>
<ns2:ApiError.Type>EntityNotFound</
ns2:ApiError.Type>
<ns2:reason>INVALID_ID</
ns2:reason>
</ns2:errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

AdWords API Advisor

unread,
Nov 18, 2009, 10:35:53 AM11/18/09
to AdWords API Forum
Hi Eugene,

There seems to be an issue where this request only works when made as
the MCC user that owns the developer token. I am working with the
core engineering team to have it resolved. To confirm, were you using
an MCC or AdWords account to make this request?

Best,
- Eric

Eugene

unread,
Nov 18, 2009, 10:44:50 AM11/18/09
to AdWords API Forum
Eric,

I used AdWords account to make this request.

But I checked a minute ago using MCC account. Error is the same.

AdWords API Advisor

unread,
Nov 18, 2009, 12:00:36 PM11/18/09
to AdWords API Forum
Hi Eugene,

Were you using the MCC account that owns your developer token? Also,
are the results and different if you make a request for
TOTAL_USAGE_API_UNITS_PER_MONTH?

Best,
- Eric

Eugene

unread,
Nov 18, 2009, 12:20:57 PM11/18/09
to AdWords API Forum
Hi Eric,

As for MCC account... how can I check if it owns my developer token?

Results are the same when I use TOTAL_USAGE_API_UNITS_PER_MONTH.

Why don't you run the code below on your server?

require_once '/var/www/adwords/src/Google/Api/Ads/AdWords/Lib/
AdWordsUser.php';
$user = new AdWordsUser(
NULL,
'xxxxxxx',
'xxxxxxx',
'xxxxxxxxxxxxxxxxxxxx',
'xxxxxxxxxxxxxxxxxxxx',
'',
NULL
);
$infoService = $user->GetInfoService();
$is = new InfoSelector();
$is->apiUsageType = TOTAL_USAGE_API_UNITS_PER_MONTH;
$infoPage = $infoService->get($is);

thanks

AdWords API Advisor

unread,
Nov 18, 2009, 12:53:09 PM11/18/09
to AdWords API Forum
Hi Eugene,

To tell if your account owns the developer token, log in to the
AdWords web interface with your MCC credentials and navigate to "My
Account" -> "AdWords API Center". If there is no AdWords API Center
option than that is not the account that owns the developer token.

I have tried running these requests for my own accounts and everything
works fine if I use the MCC user that owns the token. I'm only able
to get the EntityNotFound.INVALID_ID error if I use an AdWords account
for the request. Because of this I think that you are either using
the wrong accounts or there is a problem with you accounts.

Best,
- Eric

Eugene

unread,
Nov 18, 2009, 1:24:20 PM11/18/09
to AdWords API Forum
Eric,

I found email and password associated with my token and it works!
And yes it works only with MCC account email/password.

Thank you very much!

Is there any way to contact you directly to get help faster? We are
migrating our apps from apility (v13) to PHP Client Library for
AdWords API v2009. So I think we will have more problems, questions...

Thanks again.

AdWords API Advisor

unread,
Nov 18, 2009, 2:11:21 PM11/18/09
to AdWords API Forum
Hi Eugene,

Great, I'm glad to hear that it's working now. I'm working with the
documentation team to make the authentication requirements clearer.
The forum is the best way to get help with the AdWords API, and we try
to respond to questions at least twice a day.

Best,
- Eric

fred

unread,
Dec 1, 2009, 2:20:04 AM12/1/09
to AdWords API Forum
Hi,
Very useful thread, thanks for that. Just want to confirm I understand
this correctly.

Does this mean that you can only call InfoService::get if the username
you use for authorisation is the same user who owns the
developerToken?

Are there any other situations in v2009 where the username and
devToken have to match? (either directly or via an MCC relationship).
As I understand it there were no such rules in v1 through v13

Thanks

On Nov 19, 6:11 am, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> > Thanks again.- Hide quoted text -
>
> - Show quoted text -

AdWords API Advisor

unread,
Dec 1, 2009, 12:01:32 PM12/1/09
to AdWords API Forum
Hi Fred,

That's correct, you must use the MCC account that owns the developer
token for all requests. This is the only service where that specific
user is required.

Best,
- Eric

fred

unread,
Dec 1, 2009, 6:39:10 PM12/1/09
to AdWords API Forum
Thanks heaps Eric. Time to start digging through very old emails.

On Dec 2, 4:01 am, AdWords API Advisor <adwordsapiadvi...@google.com>
> > > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages