I am trying to POST an order to REST API using the below code:
string URI = "https://api.myTrade.com/s1/order/" + orderId;
string myParameters = "symbol=AAPL&duration=day&side=buy&quantity=1&type=limit&price=1";
Console.Write("Parameters : " + myParameters + "\n");
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.Authorization] = "Bearer " + token
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
wc.Headers[HttpRequestHeader.Accept] = "application/json";
string responsebody = wc.UploadString(URI, myParameters);
//Console.Write("Output : " + responsebody + " ");
dynamic dynObj = JsonConvert.DeserializeObject(responsebody);
return responsebody;
}
I am getting the following exception:
Input String was not in a correct format.
Any help is greatly appreciated.