JAVA API crashes when getting a qoute of NIFTY 50 with JSON OHLC exception

tpjob2014
JAVA API crashes when getting a qoute of "NIFTY 50" with JSONException for OHLC object, pls help me getting NIFTY 50 last price.
  • sujith
    Hi @tpjob2014,
    To get Quote for indices, use getQuoteIndices() method as demonstrated here.
  • tpjob2014
    tpjob2014 edited February 2017
    Awesome thanks! It resolves my issue, but I think technically the exception is incorrect it should throw invalid symbol (or mention wrong api call for indices.) i might be wrong and you could have better justification.
  • sujith
    Hi @tpjob2014,
    JSONException you encountered is thrown because javakiteconnect can't convert indices json response to Quote Object. The same exception can happen when javakiteconnect receives broken json. So it is not good idea to hard code any error message. So we have alternate api for indices.

    PS: To make it easy for others who come across the same scenario, we will update comments of getQuote().
  • tpjob2014
    That is a great idea too. thanks
This discussion has been closed.