Question

Network details not returned on API droplet creation

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.


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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