Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Anyone know how to do this in Vultr API V2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Anyone know how to do this in Vultr API V2

I am trying to find a way of getting the API to search for a instance based on its label and than output only its instance-id.

Anyone know how to do this?

Comments

  • RickBakkrRickBakkr Member, Patron Provider, LIR

    A label is not meant as an identifier and shall never be used as such. ID is in "instance-id" for a reason ;-)

    You could always just fetch all your instances through https://api.vultr.com/v2/instances and iterate through its output until you find a match.

    Maybe it is an idea to do the above once so you can map label-instance-id and then migrate to storing / referencing instance-ids internally instead?

    Thanked by 1lokuzard
  • @RickBakkr said:
    A label is not meant as an identifier and shall never be used as such. ID is in "instance-id" for a reason ;-)

    You could always just fetch all your instances through https://api.vultr.com/v2/instances and iterate through its output until you find a match.

    Maybe it is an idea to do the above once so you can map label-instance-id and then migrate to storing / referencing instance-ids internally instead?

    I am looking to do it extarnally as I want to be able to automaticly create and remove VMs.

  • RickBakkrRickBakkr Member, Patron Provider, LIR

    @MatthewM said:

    @RickBakkr said:
    A label is not meant as an identifier and shall never be used as such. ID is in "instance-id" for a reason ;-)

    You could always just fetch all your instances through https://api.vultr.com/v2/instances and iterate through its output until you find a match.

    Maybe it is an idea to do the above once so you can map label-instance-id and then migrate to storing / referencing instance-ids internally instead?

    I am looking to do it extarnally as I want to be able to automaticly create and remove VMs.

    https://www.vultr.com/api/v2/#operation/create-instance

    Do note: "Developer Preview Only - Not Intended For Production Use"

Sign In or Register to comment.