How to check for updating environments through REST API

I would like to create a script for checking if an environment is updating. As of now we have set up alerts to check if the environments are healthy or not, but they also trigger whenever the environments are updating. We can manually edit the alert to exclude it, but it would be better if this could be done automatically.

Is this possible through the API?

Hi @adwo,

Welcome to the Octopus Forums!

I just want to be sure I’m understanding exactly what you want.

Are you wanting to create a script that will check against all environments and then report back if something has changed in that environment since the last time the script has run?

Please let me know if I understand correctly.


Hei Jeremy,

It’s something similar to what you are describing, but its not important if something has changed or not.

What I would like to create is a script that checks if the environment is currently executing an update or not. If it’s executing a updating then I would like it to report back the ID of that environment.

Edit: Something like the pseudocode here if this makes it more clear

for item in listOfEnviroments
=> Some API call to check if an update is executing
if (executing)

Hi @adwo,

By update, do you mean a currently running task/deployment?

If so, you may be able to use this as a base to get the running tasks, and instead of cancelling them, you can put some logic in and go to each task and determine the environment and output the information.

Please let me know if that’s what you mean and if you think this will work for you.


1 Like

Hey Jeremy,

Thank you, that script will do the trick. I was looking through the github yesterday, but since I write the scripts in python I didnt check the other folders.

Ådne Ovesen

1 Like

Hi @adwo,

You’re very welcome!

Thanks for letting me know that you think it will work for you.

Please let me know if you hit any bumps along the way, and if I don’t hear from you I hope you have a great rest of your week.


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