python - Error calling Reports API v1 -
i'm getting error while calling reports api:
<httperror 403 when requesting https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2013-08-01?alt=json&maxresults=1 returned "caller not have access customers reporting data.">
have seen error before? missing? can't see why showing or should checking.
regards.
edit:
auth:
credentials = signedjwtassertioncredentials( service_account_name='5163xxxxx@developer.gserviceaccount.com', private_key=oauth2_private_key, scope='https://www.googleapis.com/auth/admin.reports.usage.readonly') # https://developers.google.com/api-client-library/python/guide/thread_safety http = credentials.authorize(httplib2.http()) service = apiclient.discovery.build('admin', 'reports_v1', http=http)
the actual call:
result = service.userusagereport().get( userkey='all', date='2013-08-01', maxresults=1).execute()
other apis work fine service account. 'https://www.googleapis.com/auth/admin.reports.usage.readonly' has been added oauth2 domain config page.
try:
credentials = signedjwtassertioncredentials( service_account_name='5163xxxxx@developer.gserviceaccount.com', private_key=oauth2_private_key, scope='https://www.googleapis.com/auth/admin.reports.usage.readonly', sub='super-admin@yourdomain.com')
when using service accounts admin sdk, still need act on behalf of admin within google apps instance.
also, make sure service account client id has been granted rights use reports api scopes in google apps control panel. google drive docs describe process well, sub in reports scopes instead.
Comments
Post a Comment