Machine List incomplete

when i run the following cURL against my installation, I only get a limited set of objects.

curl --header “X-Octopus-ApiKey: API-XXXXXXX” https://octopusURI/api/environments//machines

I’m trying to build a script that will allow me to add a “target” scope and need the ID of a machine in order to do this successfully. However, when I try to poll all the machines, my “where Name = X” logic fails to find the deployment target.


Hi @Caleb,

Thanks for reaching out!

When you get a set of results from the Octopus API, if it has more than 30 items on it, It’ll only give you the first 30 and on the “Links ->” property of the JSON you get with those 30 results you’ll find a link to go to the next set of 30. You can use a FOR look to keep looping until you cannot find a “” link, meaning you’ve reached the last page.

Alternatively you could do your initial GET to /api/machines/all to get all machines from all Environments, and then filter as needed.

Hope that helps,