'MSXML2.XMLHTTP60 URL Request does not returning full Json Text
I am trying to extract one Json data from NSE web site.This invlovles cookies,before executing the MACRO codes atleast open once the URL https://www.nseindia.com/get-quotes/derivatives?symbol=TCS. So that Cookies problem will not be faced.
After this when i copy this Url "https://www.nseindia.com/api/quote-derivative?symbol=TCS" and run it in the web browser,i am receiving all the Json text starts with "{"info":{"symbol":"TCS","companyName":"Tata Consultancy Services Limited","in" etc etc.
How ever when i tried to get the same via excel macro ,i am receiving only the partial Json text, here i am attaching my macro codes and partial Json text as a image
Private Function Getresponse(ByVal Url As String) As String
Const RunAsync As Boolean = True
Const Processcomplete As Integer = 4
Dim request As MSXML2.XMLHTTP60
Set request = New MSXML2.XMLHTTP60
Dim Response As String
With request
.Open "GET", Url, RunAsync
.setRequestHeader "Content-Type", "application/json"
.send
Do While request.readyState <> Processcomplete
DoEvents
Loop
Response = .responseText
End With
Getresponse = Response
End Function
Sub Test_GetResponse()
Debug.Print Getresponse("https://www.nseindia.com/api/quote-derivative?symbol=TCS")
End Sub
Any suggestion why full response is not received please?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

