Unprocessable Entity

May 30, 2017 137 views
API Ubuntu 16.04

I'm getting a 422 Unprocessable Entity when trying to create a droplet via postman.

First, a GET to https://api.digitalocean.com/v2/images gives me a list of droplet images. Let's say I want to base my droplet on this one...

      "id": 13764801,
      "name": "Elixir on 14.04",
      "distribution": "Ubuntu",
      "slug": null,
      "public": true,
      "regions": [
      "created_at": "2015-09-30T15:42:07Z",
      "min_disk_size": 30,
      "type": "snapshot",
      "size_gigabytes": 1.85

So I POST to https://api.digitalocean.com/v2/droplets with this request body:

 "name" : "512-auto",
 "region" : "lon1",
 "size" : "512mb",
 "image" : "Elixir on 14.04",
 "ssh_keys" : ["a9:a2:b4:d2:4f:79:32:22:9d:e3:68:72:11:11:aa:aa"]

I get a 422 error... How do I make this work?

1 Answer

Hi @adam95c2fc3ac28a1681a23714

The image needs to be either a number (if using an image id), or String (if using a public image slug), so since the image you're listing doesn't have a slug I would think you need to use the id:

 "name" : "512-auto",
 "region" : "lon1",
 "size" : "512mb",
 "image" : 13764801,
 "ssh_keys" : ["a9:a2:b4:d2:4f:79:32:22:9d:e3:68:72:11:11:aa:aa"]
Have another answer? Share your knowledge.