Postback (Webhooks)

pranksterguru
Hi @vivek @Kailash ,
Postback (Webhooks) seems to be a good idea but i do not know how to implement this. there is no end point given in the document.
is it like if i implement a webhook with a order that i placed i'll get status change as and when it happens?
  • Vivek
    Yeah, you will get post request to the registered postback url in your app, to implement this you have a implement endpoint in your website or separate server which accepts json post request and you will get post request on every order status.
  • pranksterguru
    hi @vivek
    can you please give me an example for webhook api endpoint?
    is this correct ? https://myserver.com/rest/Order?payload=
  • Kailash
    It can be any url. The data comes as raw POST body, so you don't need "?payload" param. You just need to read the POST body.
  • pranksterguru
    hi @Kailash @vivek

    no matter what i do , i cant seem to get this webhook working. below is my JAX rest api implementation in java to accept post requests. i am able to hit this post using any third party utilities but not with kite api order. what should be the consumes data type? i tried almost all data type , but nothing works

    @Path("/Order")
    public class OrderPost {
    @POST
    // @Consumes(MediaType.APPLICATION_JSON)
    @Path("OrderConf")
    public Response newTodo(String payload)
    {
    i am wring something in DB here
    return Response.ok().build();
    }
    }


    this is my end point for post.
    https://myserver.com/something/rest/Order/OrderConf


    what am i doing wrong? also, please try to give more information in the document. this is taking so much time of mine trying all possibilities.

  • Vivek
    Just checked logs
    ConnectTimeout: HTTPSConnectionPool(host='ec2-54-187-30-58.us-west-2.compute.amazonaws.com', port=8443): Max retries exceeded with url: /ThinkTradeZServer/rest/Order (Caused by ConnectTimeoutError(, 'Connection to ec2-54-187-30-58.us-west-2.compute.amazonaws.com timed out. (connect timeout=3)'))
    your endpoint has port 8443 in it, and our server couldn't reach the endpoint since we blocked all outgoing ports except 80 and 443. In future we will consider opening up range of ports to be used but for now please use default SSL port (443).
  • pranksterguru
    it is not working still, can you check the log please?.... i am using a self signed ssl certificate, do you think it could be the issue?
  • Kailash
    We will investigate this in the morning tomorrow and get back to you.
  • pranksterguru
    @Kailash thanks alot..! but i dont think it is needed.. it is working now.. i didnt change the port number in the KITE APP configuration

    i remember reading in this forum that there is a webhook for login request too. in case there is a disconnect for some reason, we will get a post back call.

    i do not see this in the documentation, is it available?
  • Kailash
    There are no webhooks for logins. It's just that if you encounter a TokenException (403) at any point, that means you need to re-initiate the login.
  • pranksterguru
    i was able to get the market tick price successfully yesterday. after the market close 3.30 i was getting duplicate data for the next few minutes for few securities. i'll have to write a whole big logic to avoid the duplicates, but if you are fixing it from your end it is going to be useful for everyone.

    ex: for SBIN i received duplicate records from 2016-04-25 15:29:52 to 2016-04-25 15:30:51
  • Vivek
    We don't send any duplicate ticks, you may get few ticks after 3.30 because exchange sends us the ticks after market is closed.
  • sekharrockz
    sekharrockz edited April 2016
    @vivek ,

    can i know how can we register a post-back(web hook) to a url from your server. can i know the procedure.

    Because it's quite confusing on how to tell the kite server to send response to a specific url .

    can you explain in detail.
  • Vivek
    @sekharrockz In developer console you have field called "postback url" when you edit app.
Sign In or Register to comment.