Deploy an release to a specific machine using REST API

Hi Team,
I want to deploy an release to a specific machine/target. I am able to achieve this using octo.exe but since all our projects are using REST Apis . I also wanted to use REST API to deploy an release to an specific machine. Please let me know if we have an option to achieve this ? thanks in advance

Hi @sujeshsasi,

Thanks for getting in touch!

All of the actions within the Octopus Web Portal make use of the REST API to execute. So, anything that can be done within the UI can be scripted for the REST API.

A good starting point when creating a new script like this is to use the network tab within your browser dev tools (F12) to capture the API call being made as you perform the desired action within the UI.
e.g.
If I perform a deployment with a specific machine selected I can see the payload being sent.

The main challenge here is that the payload for the deployments endpoint requires the MachineID rather than the machine name. So, you would need to perform additional API calls to the machine endpoint to retrieve the relevant ID.

We have a sample script in our API repo that can perform a deployment of an existing release to a specified machine that may be exactly what you’re looking for.

Regards,
Paul