Please Notify us when any API level/ API responses are modified at server end

instruritesh
instruritesh edited May 2016 in General
Hi
In docs - https://kite.trade/docs/connect/v1/#retrieving-orders, these paramters were missing - market_protection, order_type, pending_quantity, placed_by. But, when I queried, I got those fields in response (I cross checked example response given in docs, but placed_by field was missing there) and I modified my code according to that. But, in query response, parent_order_id was missing, so I did not incorporate it in my JSON parsing. It was working.

Suddenly today, while fetching orders, parent_order_id was added in response and my JSON parsing failed in code and whole system went into the halt as my order management failed. Later point of time, I manually debugged and found this was JSON parsing problem.

Its my humble request to please notify us in some form, when you do any modification on API/API parameters/API responses sothat we can modify our code at right time, else at our client end, it leads to malfunctioning and losses.
  • Shabeershah2002
    I also strongly recommend this notification rather debug and debug !!
  • Kailash
    @instruritesh @Shabeershah2002 Apologies. We'll make announcements before changes like this happen. However, this was not a breaking change. A variable being removed from the response would've been.

    That said, @instruritesh , I am surprised that your parser broke. How can JSON parsing fail because there's an additional key? If you're mapping JSON to a native data structure and a new key appears, most parsers would just ignore the key and map the expected values. We have active Java, Python, PHP, Go, and Javascript routines that use the Kite Connect API and none of these required any changes.
  • instruritesh
    instruritesh edited May 2016
    @Kailash I was using Jackson JSON parser in Java, it expects a POJO class having state variables with defined keys..and then while parsing just pass the input JSON to its API and POJO class i.e. jksnMapper.readValue(inputJSON, ZOrderRespPOJO.class); Since, a new key has been added which is unknown to the POJO given to Jackson - it failed.

    But, as you said and Thanks for pointing out :smile: , I overlooked the matter that JSON fields can be added/removed, I now configured Jackson parser with FAIL_ON_UNKNOWN_PROPERTIES as false - which solved both new/removal of known key.

    But, this will still fail in the following conditions:
    1. If known field name is altered e.g. modifying "status_message" to "statusMessage"..
    2. If one crucial known key is removed e.g. "order_id" is removed from JSON - parser will give null for this field, hence system will not be able to manage orders and whole system will go for a toss.

    How are the chances of above occuring?
  • Kailash
    @instruritesh , thanks for the clarification.

    Any change to existing keys, removal or modification, would be a breaking change. We'll never do this. Break changes will always be introduced as a new API version altogether. So, zero chances :)
  • instruritesh
    Thanks @Kailash for the confirmation :smile:
Sign In or Register to comment.