Howdy, Stranger!

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

Advertise on LowEndTalk.com
Anyone know how to do this in Vultr API V2
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

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

    We offer excellent LIR services in EMEA (RIPE NCC service area) and our customers seem to love us: https://www.trustpilot.com/review/bakker-it.eu. Want to become part of the family? DM me :)

  • @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, 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"

    We offer excellent LIR services in EMEA (RIPE NCC service area) and our customers seem to love us: https://www.trustpilot.com/review/bakker-it.eu. Want to become part of the family? DM me :)

Sign In or Register to comment.