403 Error

wealthfromtrading
Hello,
I am getting the following error while getting candle data: "java.io.IOException: Server returned HTTP response code: 403 for URL:"

Please advice.
Tagged:
  • sujith
    Can you add more details about what version of javakiteconnect are you using and which API call is throwing this error?
  • wealthfromtrading
    how can i come to know this ?I use this url -> https://api.kite.trade/
  • sujith
    You can enable debugging and check that. You can check out the Test.java file in sample module on GitHub repository to know how to enable logs.
  • wealthfromtrading
    i have explicitly asked for V3 in my request as I am using conn.setRequestProperty("X-Kite-version", "3"); so it seems i am using V3 but still getting this error.
  • sujith
    Are you using javakiteconnect or using custom implementation?
  • sujith
    You need to pass authorization token in the header also.
  • wealthfromtrading
    see, I am using custom implementation. The implementation is absolutely correct. it was working for last few months , till last weekend( since last weekend i had not used it till yesterday night. )So implementation is surely not a problem. Yesterday my subscription had expired and then i extended it in the night but after extending the subscription (by paying 2k), its not working. I am not sure why. The exact same codebase was in use for last few months. Also, now i am explicitly mentioning v3 should be used, as shown in https://kite.trade/docs/connect/v3/#version-and-api-endpoint but still i am getting this problem. Please advice.
  • wealthfromtrading
    pls reply back early. I have already lost one day despite paying
  • sujith
    You need to provide more information. We can only help you if give specific details.
    https://api.kite.trade is a Kite Connect API's base URL. It is not a valid API endpoint.

    Enable debug logs and give the complete request and error response.
  • wealthfromtrading
    wealthfromtrading edited May 2018
    how can debug be enabled? the test.java that you asked me to see is based on java library which i am using. Further, I will give you a sample URL that is giving me this 403, -> "java.io.IOException: Server returned HTTP response code: 403 for URL: https://api.kite.trade/instruments/historical/975873/day?from=2015-03-15&to=2018-05-22&api_key=&access_token=xxx".

    Please ask if you need any further information. I think from this URL you should make out a couple of things:
    1. log in is done and i have access_token.
    2. This is coming while getting candle data.
  • sujith
    sujith edited May 2018
    Can you private message your api_key?
    Please don't mention app specific tokens on the public threads. You can private message if you have to mention that.
    You need an active add-on subscription to use historical data API. Have you subscribed for the same from the developers console?
  • wealthfromtrading
    i have subscribed kite connect api by paying 2k. Do i need to further give 2k for enable histrorical api?
  • sujith
    Yes, you need to subscribe to historical data API to use it.
  • wealthfromtrading
    so that means 2k for kite connect API + 2k for historical, so in a nutshell 4k is required to use historical API
  • sujith
    The historical data API provided is only for backtesting purpose. For live stratergies, you can generate candles at your end using the live market data provided via websockets.
    You can get started from here.
  • wealthfromtrading
    I have now susbscribed to historical data API as well and i am facing the same 403 problem. This is the exception i get : "java.io.IOException: Server returned HTTP response code: 403 for URL: https://api.kite.trade/instruments/historical/975873/day?from=2015-03-15&to=2018-05-22"

    I have also added the following information to my connection object : conn.setRequestProperty("X-Kite-version", "3");
    conn.setRequestProperty("Authorization", "token "+apiKey+":"+accessToken);
    to ensure version 3 is being called.

    Please advice.
  • sujith
    You need to re-login then only it will work otherwise it will keep throwing 403
  • wealthfromtrading
    have done that, and still getting the same issue.
  • wealthfromtrading
    you have my details with you, can you check what is going on the backend? why am i getting this error.
Sign In or Register to comment.