//var data = "['NSE:INFY', 'BSE:INFY']"; // //using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream())) //{ // streamWriter.Write(data); //}
var httpResponse = (HttpWebResponse)httpRequest.GetResponse(); string result; using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { result = streamReader.ReadToEnd(); } json = JsonConvert.DeserializeObject(result);
@arjunender, A third party website can't display our market data and candle data. You can speak to compliance at kiteconnect(at)zerodha.com for more information.
I totally agree, but I think that you shouldn't learn coding if you want to open, for example, an e-commerce site, or if you already have a site on Magento, and you want to make it on Magento 2. It's better to entrust this to professionals https://dinarys.com/magento-to-magento2
cross-origin resource sharing error preflightmissingalloworiginheader
$.ajax({
url: "https://api.kite.trade/quote/ltp?i=NSE:INFY",
type: 'GET',
dataType: 'json',
cors: true,
contentType: 'application/json',
secure: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "token api:token");
},
success: function (data) {
alert(data);
}
})
i am able to get margins (https://api.kite.trade/margins/basket?consider_positions=false) with API AND TOKEN
can i get LTP ("https://api.kite.trade/quote/ltp?i=NSE:INFY") with API AND TOKEN
If yes
below is the code not working am i missing something
var url = "https://api.kite.trade/quote/ltp?i=NSE:INFY";
var httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";
httpRequest.Headers["Authorization"] = "token " + api + ":" + accesstoken;
httpRequest.ContentType = "application/x-www-form-urlencoded";
//var data = "['NSE:INFY', 'BSE:INFY']"; //
//using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
//{
// streamWriter.Write(data);
//}
var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
string result;
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
json = JsonConvert.DeserializeObject(result);
return result;
A third party website can't display our market data and candle data. You can speak to compliance at kiteconnect(at)zerodha.com for more information.