Deployment via the API - specifying Rel/Env/Spec machine by name, not ID

Hi all, I’m trying to do a deploy via powershell, via the API but this has complicated things a lot and I’m hoping for a workaround.

When I do the appropriate post, it requests the internal ids for ReleaseId, EnvironmentId and SpecificMachineIds, like this:


$json=Invoke-WebRequest -uri “” -Method POST -Body $body

This works, but I want to be able to do this with the actual names, not the ids. Is this possible?

If not, what’s the simplest way to get the ids via the API based on the field names instead?


I can find the Name based on the id, is there a way to do the reverse perhaps?


Thanks for reaching out!

There are a few ways to get this done:

Using Octoposh

Octoposh is an open source Powershell module for Octopus which has a few cmdlets that can help you look for things by their name, like Get-OctopusEnvironment -Name Production, Get-OctopusRelease -version 1.0.0 and Get-OctopusMachine -name MyVM. All of those will return an object which will have an ID property that you can later on use in your Invoke-WebRequest call.

Octoposh site:
Octoposh wiki:

Using the raw API to get the resources and filter by name
Code will say more than words in this case:

Hope that helps!

Thanks Dalmiro, nice repo there, I’ll be referring to it quite a bit I expect.
Cheers, Ben.