Date filter for Octopus APIs

Is there anyway to pass the date time filter to deploymenthistory or any other api in Octopus?

We have skip and take filters, but that does not help much.
Problem happens when I want to pull deployment data for an older date.
There is no way other than loading each page then take the Page.Next value and compare the date.

I know we can achieve this using PowerShell and SQL scripts. But I am looking for a solution specifically with APIs.

HI @Falcon_Francis,

Thanks for getting in touch!

Unfortunately not, these are the only filters available for the API call:


Thank you for your answer.

We have to be careful while using APIs because the data is keep on getting updated due to the continuous deployments.

For eg: If we try to take the tasks details using api ‘/api/tasks?skip=0&take=30’
Link to “next page” will be shown as ‘/api/tasks?skip=30&take=30’
The data for the “next page” may have some details which are already present in the ‘/api/tasks?skip=0&take=30’ if a new release and deployment has been queued during the query execution.

So APIs has to be used only with some logic to make sure we are not processing the duplicate data.

1 Like

Can I use event (/api/events) to get the filtered deployment details
I can see some parameters here


But not sure how to use this api.

The best way to visualise the /api/events/ filters is to take a look at Configuration > Audit. This will provide a list of the available filter values for fields like eventGroups and eventCategories.

One thing to be aware of is that each individual deployment will have multiple entries (deployment queued, deployment started, deployment succeeded/failed)

So, /api/events?eventCategories=DeploymentSucceeded&from=2019-06-04 would return all successful deployments for the past year.

Or, /api/events?eventGroups=Deployment&from=2019-06-04 would return all deployment events so would have the multiple entries for each deployment mentioned above.

1 Like

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