I need to create a request similar to
curl -X POST -u "ff20f250a7b3a414781d1abe11cd8cee:fb453577d11294359058a9ae13c94713" \
"https://api.hitbtc.com/api/2/order/" \
-d 'symbol=ETHBTC&side=sell&quantity=0.063&price=0.046016'
The example above is taken from: https://api.hitbtc.com/#create-new-order
I am trying to achieve that with:
string[string] params;
params["symbol"] = "ETHBTC";
params["side"] = "sell";
params["quantity"] = to!string(quantity);
params["price"] = to!string(price);
string url = "https://api.hitbtc.com/api/2/order" ;
try
{
requestHTTP(url.dup,
(scope req) {
req.addBasicAuth(apikey, apisecret);
req.method = HTTPMethod.POST;
req.writeFormBody( params );
},
(scope res) {
writeln(res.bodyReader.readAllUTF8());
}
);
}
Basic auth part is working I tested it with some other function . But I am getting a error about parameter "symbol" not found.
Is using writeFormBody correct to achieve the same result of -d option of curl? If not what should I use instead?