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??