Powershell script to add a Deployment target to an Environment

I have just scripted the creation of a new Environment in a particular Space in Octopus Deploy using:
"Invoke-RestMethod “$OctopusURL/api/$($SpaceId)/environments” -Headers $header -Method Post -Body $body -ContentType “application/json”
I have not come across an api to add a new Deployment Target to an Environment.
Is there an existing api call to do this??

Kind Regards,
Micheal Power

Hi Micheal,

Thanks for getting in touch.

We have a wealth of knowledge available for API calls on our GitHub repo:

I would also recommend looking at the YourOctopusInstance.com/swaggeruI

There are a lot more API calls available which would help you in the future.

If you require additional support please reach out to me.

Kind regards,