Unattended access to cpanel reporting data URL

19 views
Skip to first unread message

Jason

unread,
Jan 14, 2012, 12:02:42 AM1/14/12
to google-app...@googlegroups.com
Hi All,

I'd like to access domain reporting data from a cron job by access a URL of the form [1]:

https://www.google.com/a/cpanel/{domain}/ReportGviz?reportKey={reportKey}&reportDate={reportDate}

Is it possible to use 2-legged oauth so that this unattended app can access the URL?  I am asking because I cannot see a way to use 2-legged oath here, since the oath APIs set parameters on "services", and in this case, there is no service, just a URL.  (Note that the data I can get from URLs in the cpanel Reporting section are richer than what I can get from the reporting API - hence my desire to pull visualisation data from the URL).

Thanks,

Jason.

Shraddha Gupta

unread,
Jan 14, 2012, 12:46:19 AM1/14/12
to google-app...@googlegroups.com
Hi Jason,

It is not possible to use 2-legged OAuth with the Reporting API and the Reporting Visualization API.
If you want to pull visualization data from the URL, you can take the reportKey from your CPanel and use it in your application.
ReportKey is a key, secret to the consumer like consumer secret, it is not possible to access the secret from your application.

Thank you,
Shraddha Gupta
Developer Programs Engineer
Hyderabad, Google India.





Jason.

--
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/-/SVMzUkoX50EJ.
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.

Jason

unread,
Jan 14, 2012, 4:38:35 AM1/14/12
to Google Apps Domain Information and Management APIs
Thanks for the response.

Yes, I have been replacing {domain}, {reportKey}, and {reportDate}
with appropriate values - this is not the issue.

My problem is that I cannot access this URL from a cron job, because
it requires a login. Is there a way to access this URL with a
programmatic login? Note that I am a google apps administrator for
the relevant domain, but do not want to embed a password in the app.

Thanks,

Jason.

Shraddha Gupta

unread,
Jan 14, 2012, 4:56:55 AM1/14/12
to google-app...@googlegroups.com
Hi Jason,

I am not sure what exactly your query is.
You do not require to login to access this URL. As I told when working with Reporting Visualization API, there is no need to do authorization with your password or OAuth.
Please tell me how are you accessing this URL that you require a login? 

Thank you,
Shraddha Gupta
Developer Programs Engineer
Hyderabad, Google India.




Thanks,

Jason.

--
You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group.

Jason

unread,
Jan 14, 2012, 7:28:53 AM1/14/12
to Google Apps Domain Information and Management APIs
Hi.

I've written a google app engine app that returns the URL:

url = 'https://www.google.com/a/cpanel/.../ReportingDataSource?...' #
info stripped for privacy
req = urllib2.Request(url)
response = urllib2.urlopen(req)
page = response.read()

When I run this on my PC, it works fine if I am logged into google -
page contains the data. If I log out of google, page contains login
html.

This is consistent with what happens in a browser - try it - if you
are logged into google when you use a URL of this form, the data is
returned. Otherwise you will be sent a login page.

Similarly, if the app runs under google's app engine infrastructure
(from cron), a login page is returned, since google apps has been
accessed without any auth context.

So unless I am completely missing something, the question remains - is
it possible to use oath or similar to authenticate so that this URL
can be accessed?

Thanks,

J.

Shraddha Gupta

unread,
Jan 14, 2012, 8:27:49 AM1/14/12
to google-app...@googlegroups.com
Hello,

I tried opening this URL on the browser and it returns data for me without login.
I dont know what might the reason that you are asked to login.
I will get more information on this and let you know if I find out anything.

Thank you,
Shraddha Gupta
Developer Programs Engineer
Hyderabad, Google India.




J.

Shraddha Gupta

unread,
Jan 17, 2012, 5:36:32 AM1/17/12
to google-app...@googlegroups.com
Hello Jason,

Can you please confirm which URL you are using?
This URL https://www.google.com/a/cpanel/{domain}/ReportGviz?reportKey={reportKey}&reportDate={reportDate} is for the Reporting Visualization API and works perfectly without login. Please try this URL on your browser and tell me if its working for you.

In your last mail, you have given this URL
 'https://www.google.com/a/cpanel/.../ReportingDataSource?...'. This is different from the one above.
I am unable to fetch my report using this URL. Can you please check if you have shared the correct URL?
Also, please give the link to the document from where you have taken this URL. so that I can verify if you are using the correct source.


Thank you,
Shraddha Gupta
Developer Programs Engineer
Hyderabad, Google India.



Jason

unread,
Jan 18, 2012, 5:46:54 PM1/18/12
to Google Apps Domain Information and Management APIs
Hi,

Thanks for following this up.

You are right, I have described two different URIs - one includes
ReportGviz and the other has ReportingDataSource. The former is
described on the google Reporting Visualization API Reference. In
cpanel, under "Reporting"->"Usage & Reports", the ReportGviz
hyperlinks are associated with the top three reports, as can be seen
by "table" and "csv" hyperlinks on each chart. The remaining charts
have URIs that include ReportingDataSource.

I have written a GAE app uses these URIs (which return datasource
data), and renders them in a chart. It all works fine when I run my
GAE app from an environment where I have logged into google, such as
in the python dev envt on my PC, or as a GAE app. However, if I log
out of google, or run the app from GAE cron, it gets the login prompt
instead of data.

I am trying to use these datasources because google apps does not give
me the APIs to accumulate this data by myself. For example, "Docs
Viewed By Type" would be difficult (impossible?) to generate.

Thanks,

Jason.

Shraddha Gupta

unread,
Jan 19, 2012, 4:44:11 AM1/19/12
to google-app...@googlegroups.com
Hello Jason,

Thanks for the clarification.
The reports available from the Reporting Visualization API are the ones that are available without login.
These use the ReportGviz hyperlink.

While the other reports that use ReportingDataSource hyperlink are not provided by the Reporting Visualization API.
They have different implementation and do require admin login to access the reports.
So you cannot access this data without admin login from your application.

Thank you,
Shraddha Gupta
Developer Programs Engineer
Hyderabad, Google India.



Reply all
Reply to author
Forward
0 new messages