Feature request - API to querry if tentacle already exists

Using powershell you can query a tentacle by tentacle id to see if it is registered with the octopus server. (See my other thread here: http://help.octopusdeploy.com/discussions/questions/8736-programmatically-determine-if-tentacle-is-registered)

$repository.Machines.FindByThumbprint($thumbprint)

Using the rest api, the only option is to query all machines, and then filter to see if the tentacle is present.

GET /api/machines/all HTTP/1.1

Use case

The octopus deploy chef cookbook will automatically register a tentacle with an octopus server. In order to preserve idempotence, the tentacle machine needs to query the api to see if it has already been registered or not.

Thousands of servers all querying the /api/machines/all api endpint on a schedule is likely to cause a lot of excess load on the octopus server.

Instead simply ally querying by tentacle id, returning true/false if the tentacle already exists

GET /api/machines/12345678910

{
“registered”: false
}

or

GET /api/machines/all?tentacle=12345678910

Yup I agree with this. I think it would be nice to have an endpoint to check if a tentacle is registered with an endpoint. It looks like this does exist however it was not working with me. Looking into the client it seems that the api function does something to search for the thumprint:

https://github.com/OctopusDeploy/OctopusDeploy/blob/d50d579ca8a15f602ec571a213da1b8ce1c18578/source/Octopus.Client/OctopusRepository.cs#L501

And then looking at the api hypermedia links I see thumprint parameter but I do not see a way to use it.

...
Machines: "/api/machines{/id}{?skip,thumbprint}",
...

I will also go ahead and drop a link to the cookbook PR just so they have some reference

Hi Sowen and Brent,

Thank you for reaching out! This is a great idea, to query straight through thumbprints, instead of querying through tons of machines and subsequently through their thumbprints. And it can currently be done! Your API endpoint would instead be:

/api/machines/all?thumbprint=ABC123

I hope that helps!

Kenny

Awesome that does work actually Kenneth. I have added this into the cookbook to fix our use case!. I know I saw this in the octopus deploy implementation when browsing teh code but I thought I tried everything and it was not working. Glad this is available! Not sure if there is anything else that makes sense from a registration endpoint but if I think of anything Ill reach out!

Thanks Kenneth

Could we get this added to the octopus api documentation?

Glad to hear its working for both of you!

@Sowen - We are aware we are a quite bit behind in our API documentation. We have plans to vastly improve this (by programatically generating it), but for this to happen we need to make a few core changes to our API. This is definitely in our roadmap, but at the moment I cannot give you a specific time frame for when It’ll be implemented. So please feel free to ask any API related questions in our forum.

Kind regards,

Kenny

Kenneth One thing that might help you guys in this effort is the following:

Not sure if you are familer with raml at all but its a pretty cool markup language! It turns into the following page with tools and certain generators.

https://anypoint.mulesoft.com/apiplatform/cvent-3/#/portals/organizations/ce5a0400-9714-4c97-b51d-522564251669/apis/23094/versions/24555