500 Server Error using Reporting API/Perl

45 views
Skip to first unread message

Jason Funk

unread,
Aug 4, 2011, 10:57:38 AM8/4/11
to google-app...@googlegroups.com
I'm probably just doing something wrong, but I'm unsure what it is:

I use the ClientLogin Authentication to generate a token, then use the following (in test phase) Perl code to submit a request:

my $lwp = LWP::UserAgent->new;
my $xml = <<EOM;
<?xml version="1.0" encoding="UTF-8"?>
<rest xmlns="google:accounts:rest:protocol"
    xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance ">
    <type>Report</type>
    <token>$auth_token</token>
    <domain>$domain</domain>
    <date>2011-08-04</date>
    <reportType>daily</reportType>
    <reportName>accounts</reportName>
</rest>
EOM

my $url = 'https://www.google.com/hosted/services/v1.0/reports/ReportingData';
$response = $lwp->post($url,
    'Content_Type' => 'application/atom+xml; charset=UTF-8',
    'Content' => $xml
);

And the response:

<?xml version="1.0" encoding="UTF-8"?>
<hs:rest xmlns:hs="google:accounts:rest:protocol">
    <hs:status>Failure(2001)</hs:status>
    <hs:reason>InternalError(1011)</hs:reason>
    <hs:extendedMessage>No extended message available for this error.</hs:extendedMessage>
    <hs:result></hs:result>
    <hs:type></hs:type>
</hs:rest>


Am I required to encode the xml like with standard POSTs?  Pass it in with a certain variable name?  Or is there possibly an issue right now with the API?

Any/all help is MUCH appreciated.

THANX!

Jason

Robert Norris

unread,
Aug 5, 2011, 1:02:25 AM8/5/11
to google-app...@googlegroups.com
I've only ever been able to get the Reporting API working using OAuth - ClientLogin has never worked for me, and gives me the same error that you see. It could be me doing something wrong but I remember spending a couple of hours on it at the time before giving up and switching to OAuth.



--
You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-apps-mgmt-apis/-/SawA6_HsJ24J.
To post to this group, send email to google-app...@googlegroups.com.
To unsubscribe from this group, send email to google-apps-mgmt...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Brian Mcnamara

unread,
Aug 5, 2011, 6:20:02 AM8/5/11
to google-app...@googlegroups.com
For what it's worth you could take a look at sample code in some other languages - http://code.google.com/p/google-apps-reporting-api-client/downloads/list.  The Python version is using Client Login rather than OAuth.

Regards,
Brian

Brian McNamara, Certified Google Apps Deployment Specialist
Deployment Manager | LTech | bmcn...@ltech.com | 908-566-1728

Claudio Cherubino

unread,
Aug 5, 2011, 3:17:57 PM8/5/11
to google-app...@googlegroups.com
Jason,

What authentication token from Client Login are you using?
Please note that the Reporting API uses the SID token and not the Auth token:


Claudio

Jason Funk

unread,
Aug 5, 2011, 4:00:49 PM8/5/11
to google-app...@googlegroups.com
Thank you all.  I'll look into the suggestions.  I haven't delved into OAuth, yet, but I need to.  I didn't want to for this particular project since it's just a simple one-off reporting script...

I'll report back with information.

Thanx.
Reply all
Reply to author
Forward
0 new messages