Exception is coming while cancelling CoverOder

billapavi
public Order cancelOrder(Map params, String orderId, String variety) throws KiteException {
String url = routes.get("orders.cancel").replace(":variety", variety).replace(":order_id", orderId);
params = authorize(params);

JSONObject jsonObject = new KiteRequest().deleteRequest(url, params);
Order order = new Order();
order.parseOrderPlacedResponse(jsonObject);
return order;
}
using above code and getting below exception
{"error_type":"GeneralException","message":"Route not found","status":"error"}

im using latest api gving proper parent id as well order id still getting this issue please provide solution to it
  • sujith
    Hi @billapavi,
    You need to pass parent order id.
    Check out the example for the exit of a special order here.
  • billapavi
    hi sujith thanks for the quick replay.
    my code will fetch Trigger pending Orders related to Cover Order and cancle/exit them on a particular time.
    params.put("parent_order_id", order.parentOrderId);
    Order cancelOrder = kiteConnect.cancelOrder(params, order.orderId, order.product);
    im using above code to exit it but still i'm getting exception.
  • billapavi
    in the message body i can see route not found
  • sujith
    Hi @billapavi,
    You need to pass variety as the third argument and not product.

    Order cancelOrder = kiteConnect.cancelOrder(params, order.orderId, order.variety);
  • billapavi
    thanks sujith it worked well .you made my day :)
This discussion has been closed.