Order integration with desktop application

rajeshbadiye
Hello,
We have been advised to use Kite Publisher API for triggering order from our desktop application. Earlier we were consuming REST api for sending order and order screen was built within application.
But we dont know how we can convert desktop order screen to web based order
Can you please provide some more details on how orders can be sent from desktop application using web interface?
Do we need to develop any web page for this?
Do we need to host this page on our site?

Thanks,
Rajesh
  • sujith
    Hi @rajeshbadiye,
    You will have to integrate Webview inside your application and make a post request to webview. For more details you can check offsite order execution on documentation.
  • rajeshbadiye
    Hello,
    Exact flow is still not clear to me.
    As part of initialization we get user authenticated during application startup and acquire request token, access token and public token.
    Can any of this be used at the time of sending order?
    What URL should be used for posting order data?
    Can order html form be constructed in application and then send it to kite url?
    Or do we need to host any hidden page on our site and invoke it with pre-populated data mentioned in "offsite order execution"?
    Why API exposed by kite can not be used for placing order directly from client application?

    Thanks,
    Rajesh
  • sujith
    Hi @rajeshbadiye,
    If you allow the user to login using webview, then you can enable cookie which will store session details and hence when you open basket order page then the user doesn't have to relogin while placing an order.
    You can make a form in your application and post it. It doesn't have to be html. You just need to open webview with post request to https://kite.trade/connect/basket
  • rajeshbadiye
    rajeshbadiye edited April 2017
    We are using web browser control in our application and trying to submit form. but nothing is happening. browser window remains blank
    See following html that is being placed in browser control.
    what could be problem?

    <'html>
    <'head><'title>Order<'/title><'/head>
    <'body>
    <'form method="post" id="basket-form" action="https://kite.trade/connect/basket">
    <'input type="hidden" name="api_key" id="api_key" value="<publisher key>" />
    <'input type="hidden" id="basket" name="data" value=" " />
    <'/form>
    <'script>
    document.getElementById("basket").value = "{"tradingsymbol":"ALBK17APRFUT","exchange":"NFO","transaction_type":"BUY","order_type":"LIMIT","quantity":1,"product":"NRML","price":"0","trigger_price":"","disclosed_quantity":1,"validity":"day","tag":""}";
    document.getElementById("basket-form").submit();
    <'/script>
    <'/body><'/html>
  • sujith
    Hi @rajeshbadiye,
    You need to send payload as an array of objects.
  • rajeshbadiye
    Correction made but still blank screen is displayed. Looks like page contents are not compatible with browser control. Is there any specific version of IE is required? Because c# application can not decide which browser to use when web browser control is used.
  • sujith
    @rajeshbadiye,
    You can use webkit.NET or some other alternative.
Sign In or Register to comment.