DO Ideas 2

API - Create Droplet Should Return IP Address

I would love when creating a droplet with the API for the IP to be returned so I can script the spin-up of servers

  • ZZ
  • Sep 11 2018
  • Shipped
  • Attach files
  • John commented
    September 11, 2018 19:02

    Moisey Uretsky (Head of Product, Digital Ocean) commented ยท June 21, 2013 10:59 p.m.
    The IP is displayed on the droplet itself when it has been set.

    So doing a request to droplets/[ID] will bring it up.

    -----------------------------------------------------------------------------------------------------

    The api documentation doesn't show the ip address in the sample response, you should add it and add a comment that it will only show once the server is up and running.

    https://www.digitalocean.com/api_access#droplets-show

  • Moisey Uretsky commented
    September 11, 2018 19:02

    The IP is displayed on the droplet itself when it has been set.

    So doing a request to droplets/[ID] will bring it up.

  • Rafael commented
    September 11, 2018 19:02

    It wont work for me.
    When showing events it wont bring droplet's ip..

  • Moisey Uretsky commented
    September 11, 2018 19:02

    Anytime =]

  • ZZ commented
    September 11, 2018 19:02

    OK, thanks for the speedy response.

  • Moisey Uretsky commented
    September 11, 2018 19:02

    You can poll against the event until its percentage is 100 and action_status is done:

    https://api.digitalocean.com/events/[:event_id]

    The event id of the create process is returned after you issue the create, after its done you can then poll the droplet and you will have the IP info available.

  • ZZ commented
    September 11, 2018 19:02

    Thanks Moisey. Is there a way to 'wait' for the IP?

    ZZ

  • Moisey Uretsky commented
    September 11, 2018 19:02

    The IP is returned you may need to query it one or more times because it takes a minute for it to be associated with the virtual server and you can also query the event to see when its done processing and then query the server and you'll have the IP.

    Thanks