title: Array in body for httr POST request
body: <p>This curl call works to create a new droplet on Digital Ocean</p>
  
  <pre><code>curl -X POST "https://api.digitalocean.com/v2/droplets" \
     -d '{"name":"test3","region":"nyc2","size":"512mb","image":5562742,"ssh_keys":[89103]}' \
     -H "Authorization: Bearer $TOKEN" 
     -H "Content-Type: application/json"
  </code></pre>
  
  <p>However, I'm having trouble getting an <code>httr::POST()</code> request to work only when the parameter <code>ssh_keys</code> is given.  In the above method the <code>ssh_keys</code> parameter, if given, has to be an array.</p>
  
  <p>I assumed the list of parameters could be passed to the body as, e.g., where the <code>ssh_keys</code> parameter is inside a list</p>
  
  <pre><code>args &lt;- list(name="test3", region="nyc2", size="512mb", image="5562742", ssh_keys=list(891111))
  POST(url, config=auth, body=args)
  </code></pre>
  
  <p>I assume this is what's happening on the inside:</p>
  
  <pre><code>jsonlite::toJSON(args)
  
  [1] "{ \"name\" : [ \"test3\" ], \"region\" : [ \"nyc2\" ], \"size\" : [ \"512mb\" ], \"image\" : [ \"5562742\" ], \"ssh_keys\" : [ [ 89103 ] ] }"
  </code></pre>
  
  <p>Which I imagine would work, but perhaps that's not what's happening? Fiddling with the <code>encode</code> parameter in <code>POST</code> doesn't seem to help. </p>
  
  <p>The curl call works from terminal, but using <code>httr::POST()</code> I keep getting the error message </p>
  
  <blockquote>
    <p>You specified invalid ssh key ids for Droplet creation.</p>
  </blockquote>