owainlewis / digital-ocean

Idiomatic Clojure client for Digital Ocean that makes it easy to boot virtual servers from your REPL
37 stars 13 forks source link

passing ssh_keys into create-droplet not working #15

Closed behrica closed 9 years ago

behrica commented 9 years ago

I use v2 librarz now, and want to pass ssh keys into the new-droplet method, like this:

(create-droplet "my tokem" nil {:name "test123":region "ams3" :size "512mb" :image 6373176 :ssh_keys [42250]})
 {:id "unprocessable_entity", :message "You specified invalid ssh key ids for Droplet creation."}

but I always get the same error. It works with curl:

curl -X POST "https://api.digitalocean.com/v2/droplets" -d'{"name":"My-Droplet","region":"ams3","size":"512mb","image":6373176,"ssh_keys":[42550]}' -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json"

I tried all possible ways to encode the array of key ids, such as:

but without success. Using fingerprints does not work neither.

An idea what could be wrong ? Do you have a working example setting the ssh-keys ?

owainlewis commented 9 years ago

Hi. Yeah this looks like a JSON encoding issue when the HTTP request is pushed out. I have fixed it locally and successfully created a droplet using the SSH keys. I'll push it out to Clojars for you now.

owainlewis commented 9 years ago

For reference

https://github.com/owainlewis/digital-ocean/blob/master/src/digitalocean/v2/core.clj#L38

behrica commented 9 years ago

It works now. Thanks.

owainlewis commented 9 years ago

:+1: