If anyone is still having this problem, the answer is to use the POST method on your httpClient obj (whatever you're using) and set a header value. ("_method": "DELETE")
It needs to be POST because you're adding a request body, which isn't supposed to work with the DELETE verb.
So a request will look like this:
Method: POST
POST body:
{
"dealId": "<deal id>",
"direction": "SELL",
"size": "1",
"orderType": "MARKET",
}
All the rest could be null
Headers:
X-IG-API-KEY: <your api key>
X-SECURITY-TOKEN: <your token from logging in>
CST: <your cst token from logging in>
Content-Type: application/json
Version: 1
_method: DELETE
Hope this helps