Report this

What is the reason for this report?

Network details not returned on API droplet creation

Posted on March 10, 2019
imed

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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.