Unnie
Unnie

Reputation: 947

Office 365 Management API always returning last 24 hours data

I am trying to fetch audit log data from Office 365 using O365 Managment Activity APIs. I am facing this issue that all my requests are returning data for last 24 hours, even when I pass a startTime & endTime in the original request.

Below is the url I am forming for my request. Here I am trying to get data for last 3 hours. I also tried the same with last 3 days but same result.

https://manage.office.com/api/v1.0//activity/feed/subscriptions/content?PublisherIdentifier=&contentType=Audit.SharePoint&startTime=2017-11-24T13:52:43.6236735Z&endTime=2017-11-24T16:52:45.0966735Z

In my response I get a nextpage URI but it has starttime & endtime as last 24 hours.

Any help is much appreciated!

Upvotes: 1

Views: 520

Answers (1)

smotti
smotti

Reputation: 233

The docs provide information on the proper timestamp format for startTime and endTime:

YYYY-MM-DD
YYYY-MM-DDTHH:MM
YYYY-MM-DDTHH:MM:SS

It also states that by default only events of the last 24 hours are returned if startTime and endTime aren't present (in this case it seems to fallback to the default because they are malformed). Furthermore they can't be more than 24 hours apart.

The API seems to accept the improper timestamps when there's no nextpage query parameter, as soon as this parameter is present the api actually returns an unhelpful AF50004 error.

Upvotes: 2

Related Questions