Get a child step definition via RESTAPI

I am working on a targeted export ability where I need to be able to see what the job configuration is/was at a specifc point in time. For most things it was easy enough to get to the information I needed using the RESTAPI.

Where I’m being stopped is getting to the child step information. I was able to see what the ID and name of these steps are using: $project.Variables.ScopeValues.Actions. Where it gets really foggy is 1) programmatically associating the child ‘Actions’ with their parent step and 2) getting the actual definition of the Action.

I’ve been through the API documentation on Github and I don’t see any way (using the RESTAPI) to get to this information.

Any help would be greatly appreciated.

Hi Micheal,

Thanks for getting in touch! The details of the deployment process for a project are only accessible through the API through the /api/deploymentprocesses endpoint which returns a json blob that contains details of all steps and their child actions for the entire project.

You can look at /api/projects to find your project (or if you already know its id call /api/projects/{id} then in the Links object that is returned in the project you will see a DeploymentProcess endpoint that includes the deploymentProcessId you will need. Once you have that it won’t change, so you can use it directly in your script, the endpoint will look something like /api/deploymentprocesses/deploymentprocess-Projects-1

If that doesn’t have what you want please feel free to get back in touch with some more details of what you are trying to achieve and I’ll be happy to help out more.

Hope that helps!


Mark, thanks for the reply but that’s where things are getting messy! Let me explain what I have and what I’m seeing.

First, we are running Octopus version 3.2.14 and using the REST API for all my automation interactions and have written a few PowerShell modules to help make that interaction simpler.

I have created a test project that I’m using for this so you can see the results. Rather than attaching a bunch of images, I’ve created a zip file of my output from commands and screenshots.

First you’ll notice my job has steps (2) and child steps within each one (screenshots DummyProject-screenshot-(1&2).png)
project.json contains the output of the api when I ‘GET’ it.
Deploymentprocess.json contains the output when I ‘GET’ the deployment process. You’ll notice that this is suspiciously missing any ‘Actions’
Action.json contains the output when I ‘GET’ the ‘Variables.ScopeValues.Actions. Clearly it shows actions but no association with the parent ‘Step’

So, what I’m looking for is the right way to associate the action (in Variables) with the correct parent step (do I need to do some screwy string manipulation and comparison to accomplish this?) and to see the actual contents of the Action (parameters and such). I would expect the ‘Actions’ step of the Deployment Process to show me the actions associated to that step. Am I seeing a bug?

Hope this helps to describe my dilemma more accurately.


Micheal Schexnayder (106 KB)

Hi Micheal,

What you are seeing is certainly unusual. The strange thing is the deployment process endpoint is what is used to display the deployment process in the screenshot you’ve sent (the Octopus web app uses the public API). Is it possible the tool/language you are using to fetch the json blob is truncating once it reaches a certain depth perhaps? The following powershell works for me against 3.2.14:

$webclient = New-Object System.Net.WebClient
$webclient.Headers.Add('X-Octopus-ApiKey', 'API-XXXXXXXXXMYKEYXXXXXXXXXXX')

Can you open up the Chrome developer tools while browsing to the deployment process screen and have a look at the Network tab and see if you can see it calling out to the deployment process endpoint and see if that looks right? I’ve attached a screenshot of doing his on our demo site. If you need some guidance on this let me know.

Another thing I noticed while looking in to this, although this isn’t related to your current issue. It looks like version 3.2.14 was pulled from our site shortly after release because it contained a bug that will cause you problems when you go to upgrade. Apparently in 3.2.14 tentacles can only talk to a server on exactly that version, so when you go to upgrade the server, the tentacles all lose communications and the server can’t upgrade them. There is a workaround detailed here or if you only have a few tentacles you can upgrade them manually. Please reach out to us at support when you plan an upgrade if you need any help at all with this.


And there you go. The dreaded ‘-Depth’ parameter has struck again!

I’m using PowerShell to run the query and when I include the ‘-Depth 10’ parameter I get the missing information! What a rookie mistake!

As to the issue with the tentacles, thanks for the heads up. We’ll be in touch if we run into serious difficulty when it’s time to upgrade!

Thank you for your help!

Micheal Schexnayder