By imed
Hello,
When creating a new droplet using the API, the response does not contain the network details of the newly created droplet (like the public and private IP adresses). In the response JSON, I have the following element :
"networks":{"v4":[],"v6":[]}
As you can see the “v4” and the “v6” arrays are empty. Is there an option I need to pass in the request to get these details or am I just supposed to make an additional request to get the newly created droplet’s details (by passing the droplet ID that is returned from the create droplet request).
Thanks for your help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Your last instinct is correct… You need to make an additional request to get the newly created droplet’s details (by passing the droplet ID that is returned from the create droplet request).
When you make a command to create a droplet the API needs to give you an immediate response, but actually provisioning of the Droplet (including associating i with IP addresses) might take up to 55 seconds.
The create command will always return an id, and then you can poll the /v2/droplets/$DROPLET_ID endpoint for the provisioned IP info. https://developers.digitalocean.com/documentation/v2/#retrieve-an-existing-droplet-by-id
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.