Modifying Order

KUL
I am trying to modify the pending order , but getting server error : "The remote server returned an error: (500) Internal Server Error." can you provide any reference for it.
  • Vivek
    Could please post request params here?
  • KUL
    HttpWebRequest req = WebRequest.Create(new Uri("https://api.kite.trade/orders/regular/" + orderId.ToString())) as HttpWebRequest;
    req.Method = "PUT";
    req.ContentType = "application/json";

    req.ContentLength = data.Length;

    using (var streamWriter =new StreamWriter(req.GetRequestStream()))
    {
    streamWriter.Write(data.ToString());
    }
    string result = null;
    using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
    {
    StreamReader reader = new StreamReader(resp.GetResponseStream());
    result = reader.ReadToEnd();
    }
  • Kailash
    I'm guessing `data` is the list of order parameters, which you haven't included. Can you share the actual order parameters?
  • KUL
    StringBuilder valuesSendToZerodha = new StringBuilder();
    valuesSendToZerodha.Append("api_key=" + Api_Key);
    valuesSendToZerodha.Append("&access_token=" + AcessToken);
    valuesSendToZerodha.Append("&tradingsymbol=" + tradingsymbol);
    valuesSendToZerodha.Append("&transaction_type=" + transaction_type);
    valuesSendToZerodha.Append("&order_type=" + order_type);
    valuesSendToZerodha.Append("&product=" + product);
    valuesSendToZerodha.Append("&quantity=" + quantity);
    valuesSendToZerodha.Append("&price=" + price);
    valuesSendToZerodha.Append("&trigger_price=" + trigger_price);
    valuesSendToZerodha.Append("&exchange=" + exchange);
    valuesSendToZerodha.Append("&validity=" + validity);
    valuesSendToZerodha.Append("&disclosed_quantity=" + disclosed_quantity);
  • Kailash
    Hm, the parameters look correct. What is the exact JSON response you are getting from the API?
  • KUL
    Not Getting any JSON response , just giving an exception as "The remote server returned an error: (500) Internal Server Error."
  • Kailash
    Hm, that is unlikely. Even the error should be a JSON response.
  • KUL
    We have noticed that even if we pass MIS as Product while putting offsite order, it is converted to CNC on your basket order interface. Is it intentional or a flaw?
Sign In or Register to comment.