TradingAPIs icon indicating copy to clipboard operation
TradingAPIs copied to clipboard

Please update the sample code for C#

Open Navanethapperumal opened this issue 4 years ago • 6 comments

Hi,

I tried to integrate the sample code with my C# application. I seen lot of things are not working. I cross verified the Java sample code and found lot of things are missing in C#. example: subscription key is not added in the header. Market Feed api is not at all working.

Please update the sample code.

Navanethapperumal avatar May 10 '21 11:05 Navanethapperumal

Hi..!! Thank you for updating us on the missing Ocp-Apim-Subscription-Key in the C# sample code. We will update the sample code and upload it on GitHub. Can you share the API response which you are receiving as an error and also the name of APIs which are not working?

api-iifl-securities avatar May 23 '21 20:05 api-iifl-securities

Request Body: {"head":{"appName":"<maskedappName>","appVer":"1.0","key":"<maskedkey>","osName":"Android","requestCode":"IIFLMarRQMarketFeed","userId":"<maskedUserId>","password":"<maskedpwd>"},"body":{"MarketFeedData":[{"Exch":"N","ExchType":"C","ScripCode":"1624"}],"ClientCode":"99999<masked>","Count":1,"ClientLoginType":0,"LastRequestTime":"Date(637574773565314160)","RefreshRate":"H"}}

Request Header: [{"Key":"Accept","Value":["application/json"]},{"Key":"Ocp-Apim-Subscription-Key","Value":["<maskedsubscriptionkey>"]},{"Key":"Cookie","Value":["IIFLMarcookie=4der1jikmndkeh2tn5dfkcpn"]}]

Response: {StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Cache-Control: private Date: Mon, 24 May 2021 14:25:14 GMT Request-Context: appId=cid-v1:6aa3a04c-7942-4767-a597-8eb4808c618a X-Android-Received-Millis: 1621866314682 X-Android-Response-Source: NETWORK 400 X-Android-Selected-Protocol: http/1.1 X-Android-Sent-Millis: 1621866314078 X-Powered-By: ASP.NET Content-Length: 1647 Content-Type: application/json }}

Please advise me anything is wrong in my request.

Navanethapperumal avatar May 24 '21 14:05 Navanethapperumal

Hi @Navanethapperumal, Did you find any solution for MarketFeed ?

pankaj5080 avatar Jun 29 '21 14:06 pankaj5080

Dear @Navanethapperumal, In the request headers, for value = ["application/json"], the key should be "Content-Type". The value for "Accept" need not be passed in the request headers.

api-iifl-securities avatar Nov 15 '21 10:11 api-iifl-securities

Dear @api-iifl-securities , In the market feed, I'm getting empty response now. Request: {"head":{"appName":"<maskedappName>","appVer":"1.0","key":"","osName":"WEB","requestCode":"IIFLMarRQMarketFeed","userId":"<maskedUserId>","password":"<maskedPassword>"},"body":{"MarketFeedData":[{"Exch":"N","ExchType":"C","ScripCode":"426"},{"Exch":"N","ExchType":"C","ScripCode":"1085"}],"ClientCode":"<9999999>","Count":2,"ClientLoginType":<9999999>,"LastRequestTime":"/Date(1649677154668+0400)/","RefreshRate":"H"}}

Response: {"body":{"CacheTime":0,"Data":[],"Message":"","Status":0,"TimeStamp":"/Date(1649672907000+0530)/"},"head":{"responseCode":"IIFLMarRPMarketFeed","status":"0","statusDescription":"Success"}}

Navanethapperumal avatar Apr 11 '22 14:04 Navanethapperumal

Market feed is working fine now for me. I have modified the LastRequestTime as UTC time and the issue has been resolved now.

Navanethapperumal avatar May 04 '22 01:05 Navanethapperumal