API audit log result is different from web

Hello,

I am trying to use octopus API to query audit log so we can track changes via a daily report.

However, the audit result from web UI is much different from the result returned by API call.

  1. The web UI returns a lot more result than API call.
    The web UI returns 27 pages of results; but the API only returns 30 entries of events

  2. The web UI returns changes that occurred within defined time range; but the API returns today’s changes instead of yesterday’s changes.

The URL in web browser:
https://octopusdeploy/app#/configuration/audit?from=2018-12-10T00%3A00%3A00.-05%3A00&to=2018-12-11T00%3A00%3A00.-05%3A00

The URL in API call:
https://octopusdeploy/api/events?from=2018-12-10T00%3A00%3A00.-05%3A00&to=2018-12-11T00%3A00%3A00.-05%3A00

Did I do something wrong?

Any help will be greatly appreciated!

Thanks,

Ge

Hi Ge,

Thanks for getting in touch! At the bottom of the API call there is a section called Links. This contains a link which will output all of the responses returned, instead of the default 30.

Below is an example of the links section. If you browse to the Page.All link, it will return all results for the query.

Links: {
Self: "/api/events?user=",
Template: "/api/events{?skip,regarding,regardingAny,user,users,projects,environments,eventGroups,eventCategories,tags,tenants,from,to,internal,fromAutoId,toAutoId,documentTypes,asCsv,take,ids}",
Page.All: "/api/events?skip=0&from=2018-11-14T00%3A00%3A00.%2B10%3A00&to=2018-12-26T00%3A00%3A00.%2B10%3A00&take=2147483647",
Page.Next: "/api/events?skip=30&from=2018-11-14T00%3A00%3A00.%2B10%3A00&to=2018-12-26T00%3A00%3A00.%2B10%3A00&take=30",
Page.Current: "/api/events?skip=0&from=2018-11-14T00%3A00%3A00.%2B10%3A00&to=2018-12-26T00%3A00%3A00.%2B10%3A00&take=30",
Page.Last: "/api/events?skip=1680&from=2018-11-14T00%3A00%3A00.%2B10%3A00&to=2018-12-26T00%3A00%3A00.%2B10%3A00&take=30"
}

Hope that helps!

Feel free to let me know if you have any further thoughts or questions here.

Best regards,
Daniel

Hi Daniel,

Thanks for the response!

The Page.All link does return the correct number of result.

Just want to make sure, does “&take=2147483647” represent the maximum size of return value? (2147483647 bytes)

Thanks again!

Ge

Hi @Ge,

Thanks for getting in touch! I believe this is correct, we are returning the maximum size here.

Hope that helps. :slight_smile:

Best regards,
Daniel

Thanks for the clarification!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.