Issue with creating Kite session after today's Kites update (23rd Feb 2019)

rsiddhartht
Hello,

I am getting the following error while I trying to create a kite session:

Unable to parse data. {"status":"success","data":{"user_type":"","email":"[email protected]","user_name":"XXXXXXX","user_shortname":"XXXXX","broker":"ZERODHA","exchanges":["NSE","MF","BFO","BSE"],"products":null,"order_types":null,"avatar_url":null,"user_id":"XXXXX","api_key":"XXXXX","access_token":"XXXXX","public_token":"XXXXX","refresh_token":"","login_time":"2019-02-23 12:56:15"}}

P.S: I'm using .NET nuget package for Kites.
  • namburimk
    same error while trying from java
  • shortwire
    shortwire edited February 2019
    The user object being returned after session creation is missing "Products", "Exchanges", "OrderTypes" collection and hence generating a parsing exception.

    While the official library is pending to be updated by Zerodha, I have made the below changes to "User" structure in structure.cs
     APIKey = data["data"]["api_key"];
    //Products = (string[])data["data"]["products"].ToArray(typeof(string));
    Products = null;
    UserName = data["data"]["user_name"];
    UserShortName = data["data"]["user_shortname"];
    AvatarURL = data["data"]["avatar_url"];
    Broker = data["data"]["broker"];
    AccessToken = data["data"]["access_token"];
    PublicToken = data["data"]["public_token"];
    RefreshToken = data["data"]["refresh_token"];
    UserType = data["data"]["user_type"];
    UserId = data["data"]["user_id"];
    LoginTime = Utils.StringToDate(data["data"]["login_time"]);
    //Exchanges = (string[])data["data"]["exchanges"].ToArray(typeof(string));
    Exchanges = null;
    //OrderTypes = (string[])data["data"]["order_types"].ToArray(typeof(string));
    OrderTypes = null;
    Email = data["data"]["email"];
    Notice the commenting out of code for these three and adding a null to it. This is just makeshift till Zerodha publishes a fixed library or populates these 3 collections.
  • krtrader
    krtrader edited February 2019
    getting same error - JSONObject["products"] is not a JSONArray.
    org.json.JSONException: JSONObject["products"] is not a JSONArray.

    Kindly update client libraries
  • Vivek
    Issue was due to our weekend migration. Thanks for reporting, we have fixed the issue.
This discussion has been closed.