Admin Audit API query by startTime

25 views
Skip to first unread message

yotame

unread,
Aug 24, 2012, 5:17:06 AM8/24/12
to google-app...@googlegroups.com
I want to get audit log from 10 days ago.

activity_list = activities.list(
        applicationId='207535951991',customerId='xxxxxxx').execute

This works fine.but

activity_list = activities.list(
        applicationId='207535951991',customerId='xxxxxxx',startTime = datetime.datetime.today() - datetime.timedelta(days=10) ).execute()

This result Bad request

HttpError: <HttpError 400 when requesting https://www.googleapis.com/apps/reporting/audit/v1/[customerID]/207535951991?alt=json&startTime=2012-08-14+17%3A53%3A51.990000 returned "Bad Request">

Would somebody please tell me how to set condition of startTime using Python API?

yotame

unread,
Sep 17, 2012, 5:04:28 AM9/17/12
to google-app...@googlegroups.com
I formated the datetime as bellow, and it works.

(datetime.datetime.today() - datetime.timedelta(days=10)).strftime("%Y-%m-%dT%H:%M:%S.%fZ")

'2012-09-07T18:01:41.287000Z'

Reply all
Reply to author
Forward
0 new messages