GeneralException in offsite order request

g0g0l
I am getting GeneralException while trying to place offsite order request. A sample post data is api_key=7wu********an&data=[{"quantity":"1","disclosed_quantity":"1","transaction_type":"BUY","tradingsymbol":"SBIN","exchange":"NSE","validity":"DAY","order_type":"MARKET","product":"CNC"}]

I am encoding POST data in BASE64 (Tried UTF-8, same result)
  • Kailash
    @g0g0l You should not encode data in Base64! Where have you seen that?
  • g0g0l
    g0g0l edited June 2016
    I removed the encodings and now I get a ForbiddenException. The error says "Invalid API credential", but I am passing the api_key right and the same api key is working fine for retrieving orders. Do I need to send anything more?
  • g0g0l
    g0g0l edited June 2016
    Quick update: I tested the order execution in web browser (firefox) and got a GeneralException. The HTML code is as follows
    <form method="post" id="basket-form" action="https://kite.trade/connect/basket">
    <input type="hidden" name="api_key" value="7w*********van" />
    <input type="hidden" id="basket" name="data" value="" />
    </form>

    <script>
    document.getElementById("basket").value = "[{\"quantity\":\"1\",\"disclosed_quantity\":\"1\",\"transaction_type\":\"BUY\",\"tradingsymbol\":\"HINDALCO\",\"exchange\":\"NSE\",\"validity\":\"DAY\",\"order_type\":\"MARKET\",\"product\":\"CNC\"}]";
    document.getElementById("basket-form").submit();
    </script>
    The return value is as follows

    {
    "error_type": "GeneralExcepetion",
    "message": "Unknown error",
    "status": "error"
    }

    My Kite App is set to Kite Connect+Publisher, why is this thing happening?
  • Vivek
    @g0g0l You were sending quantity as string instead of integer hence our json parsing failed. We will be releasing patch for this today.
Sign In or Register to comment.