Help with pagination in the Admin Audit API

25 views
Skip to first unread message

Sushi.yum

unread,
Mar 22, 2012, 1:32:27 PM3/22/12
to google-app...@googlegroups.com
Hello,

I am not sure what I am doing wrong.  This code snippet works for the first and second page, but the third page just errors out with Backend Error.  Below is the snippet code modified from the sample audit code to loop to get more than two pages (/samples/audit/audit.py).  I am using the google-api-python-client-1.0beta8 libraries.

Error:
 apiclient.errors.HttpError: <HttpError 503 when requesting
https://www.googleapis.com/apps/reporting/audit/v1/<CUSTID>/207535951991?alt=json&actorEmail=<USERNAME>%40my.fit.edu&continuationToken=A%3A1332360357259000%3A-6996555965732959864%3A207535951991%3A<CUSTID>%26maxResults%3D1&maxResults=1 returned "Backend Error">

Code:
    activities = service.activities()

    # Retrieve the first two activities
    #print 'Retrieving the first 2 activities...'
    activity_list = activities.list(
        applicationId='207535951991', customerId='<CUSTID>', maxResults='1',
        actorEmail='<USERNAME>@my.fit.edu').execute()
    print_activities(activity_list)

    pages = range(2)
    for i in pages:
      # Now retrieve the next 2 events
      match = re.search('(?<=continuationToken=).+$', activity_list['next'])
      if match is not None:
        next_token = match.group(0)

        #print '\nRetrieving the next 2 activities...' 
        activity_list = activities.list(
            applicationId='207535951991', customerId='<CUSTID>',
            maxResults='1', actorEmail='<USERNAME>@my.fit.edu',
            continuationToken=next_token).execute()
        print_activities(activity_list)

Victor Su

unread,
Mar 25, 2012, 9:38:40 PM3/25/12
to Google Apps Domain Information and Management APIs
Is it possible you are exceeding a quota limit? I have seen 503's
when I hit a rate limit, but not for the admin audit API.

On Mar 22, 10:32 am, "Sushi.yum" <curtisou...@gmail.com> wrote:
> Hello,
>
> I am not sure what I am doing wrong.  This code snippet works for the first
> and second page, but the third page just errors out with Backend Error.
>  Below is the snippet code modified from the sample audit code to loop to
> get more than two pages (/samples/audit/audit.py).  I am using
> the google-api-python-client-1.0beta8 libraries.
>
> Error:
>  apiclient.errors.HttpError: <HttpError 503 when requestinghttps://www.googleapis.com/apps/reporting/audit/v1/<CUSTID>/207535951991?alt=json&actorEmail=<USERNAME>%40my.fit.edu&continuationToken=A%3A1332360357259000%3A-6996555965732959864%3A207535951991%3A<CUSTID>%26maxResults%3D1&maxResults=1
Reply all
Reply to author
Forward
0 new messages