I want to execute the command below in Elixir using the HTTPoison library.
$ curl -X DELETE -H "expired: 1442395800" -H "signature: ******************" -d '{"api_key":"***************","delete_path":"*******","expired":"****"}' https://cdn.idcfcloud.com/api/v0/caches {"status":"success","messages":"We accept the cache deleted successfully."}
When I validate a document as DELETE in HTTPoison
def delete!(url, headers \\ [], options \\ []), do: request!(:delete, url, "", headers, options)
Only url and header required. So where should I put the request body (json body in curl )?
In Elixir I tried
req_body = "{\"api_key\":\"#{api_key}\",\"delete_path\":\"#{delete_path}\",\"expired\":\"#{expired}\"}" url = "https://cdn.idcfcloud.com/api/v0/caches" response = HTTPoison.delete!(url, header, [req_body])
But it doesn't seem to work. Can anyone tell how to do this correctly?
็ๅฟ่ป
source share