Report this

What is the reason for this report?

Create droplet from snapshot API not working

Posted on May 6, 2018
Josh

By Josh

I am trying to create a droplet via a curl call from window 10. I have installed curl and it works by itself.

The command I am trying to use is

curl -X POST -H ‘Content-Type: application/json’ \ -H ‘Authorization: Bearer $TOKEN’ -d \ ‘{“name”:“blah”,“region”:“nyc3”,“size”:“s-1vcpu-1gb”,“image”: “codenodejs-April-30”}’ \ “https://api.digitalocean.com/v2/droplets

I want to create the droplet from a snapshot. End goal is to create something for quick deployment of images.

I took the command found in the API docs and only changed the token and the image name. I want to add monitoring too but can’t even get a droplet without monitoring to work right.

Here is the error message I get

curl: (6) Could not resolve host: application curl: (6) Could not resolve host:
curl: (6) Could not resolve host: Bearer curl: (6) Could not resolve host: TOKEN’ curl: (3) [globbing] unmatched brace in column 2 curl: (3) [globbing] unmatched close brace/bracket in column 20 curl: (6) Could not resolve host:
{“id”: “unauthorized”, “message”: “Unable to authenticate you.” }



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.

It appears that Curl is not parsing your -H options properly and for some reason is seeing them as the target URL.

You seem to have a few \ within the command. Are these escaping line-breaks on Windows?

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.