Report this

What is the reason for this report?

How to create a droplet from a snapshot through API?

Posted on February 27, 2015

Everything is in the title…

I have a snapshot named dev-box, when I try to do the following, I get an error:

curl -s -X POST -d '{
>   "name": "dev",
>   "region": "ams2",
>   "size": "8gb",
>   "image": "dev-box",
>   "ssh_keys": [],
>   "backups": false,
>   "ipv6": false,
>   "user_data": null,
>   "private_networking": null
> }' -H 'Content-Type: application/json' -H 'Authorization: Bearer token' https://api.digitalocean.com/v2/droplets
{"id":"unprocessable_entity","message":"You specified an invalid image for Droplet creation."}

What am I doing wrong?

Thanks



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.

The image variable when creating a droplet expects an image id, not an image name. You will need to first hit the images endpoint in order to get the ID for the image you wish to use.

Thanks for your help. Will add needed call to retrieve image id then!

regards,

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.