How to create a droplet from a snapshot through API?

February 27, 2015 1k views

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'
{"id":"unprocessable_entity","message":"You specified an invalid image for Droplet creation."}

What am I doing wrong?


2 Answers

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!


Have another answer? Share your knowledge.