Did you add the scope:
https://www.googleapis.com/auth/apps/reporting/audit.readonly
to your list of oauth scopes?

I'm also working on doing this  in Python via the API and get to about
the same place as you - still haven't cracked it though.  Using the
API_KEY is  a new wrinkle and I'm not sure how using this will be
feasible in production code.

On Jun 8, 3:27 pm, Gwyn Howell <[email protected]> wrote:
> By toggle the "Audit API" button, I assume you mean enabling the Audit API
> for the API Console? In which case, I have done that.
>
> Second, I was able to query the API for the Customer ID and am using the
> same auth header for this request, so assume I am authenticating properly.
>
> I am extending the gdata.apps.service.PropertyService class (python) which I
> assume takes care of auth much like the other APIs, although I may be
> incorrect here as this is the first API I have used that requires the API
> Key.
>
> Here is some sample code:
>
> CONTROL_PANEL_APP_ID = '207535951991'
> class AdminAuditService(gdata.apps.service.PropertyService):
>     def get_cust_id(self):
>         try:
>             uri = '/a/feeds/customer/2.0/customerId'
>             return self._GetProperties(uri)
>         except gdata.service.RequestError, e:
>             raise AppsForYourDomainException(e.args[0])
>
>     def retrieve_all(self, api_key, cust_id=None):
>         if not cust_id:
>             cust_id = self.get_cust_id()
>             cust_id = cust_id['customerId']
>         try:
>             uri =
> 'https://www.googleapis.com/apps/reporting/audit/v1/%s/%s?key=%s&maxRe...
> % (cust_id, CONTROL_PANEL_APP_ID, api_key)
>             return self._GetProperties(uri)
>         except gdata.service.RequestError, e:
>             raise AppsForYourDomainException(e.args[0])
>
> Thanks,
> Gwyn

-- 
You received this message because you are subscribed to the Google Groups 
"Google Apps Domain Information and Management APIs" 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/google-apps-mgmt-apis?hl=en.

Reply via email to