umamaheswaranp
New Member
- Joined
- Apr 28, 2016
- Messages
- 2
Hi,
Below is the content from the API documentation
-----------------------------------------
Authentication and token exchange:
Once the request_token is obtained from the login flow, it should be POSTed to /session/token to complete the token exchange and retrieve the access_token.
curl https://api.kite.trade/session/token \
-H "X-Kite-Version: 3" \
-d "api_key=xxx" \
-d "request_token=yyy" \
-d "checksum=zzz"
----------------------------------
I tried below VBA code and it is giving me "Missing or bad request parameters or values" error. Is my URL conversion from API document is valid?
Sub doLogin()
Dim api As String, requestToken As String, checksum As String, fullData As String, URL As String, jsonData As String
Dim JSON As Object
api = ThisWorkbook.Sheets("Login").Range("B1").Value
requestToken = ThisWorkbook.Sheets("Login").Range("B2").Value
checksum = ThisWorkbook.Sheets("Login").Range("B4").Value
URL = "https://api.kite.trade/session/token"
fullData = "X-Kite-Version: 3" & "api_key=" & api & "request_token=" & requestToken & "checksum=" & checksum
'
jsonData = CallPostMethod(URL, fullData)
MsgBox jsonData
Set JSON = JsonConverter.ParseJson(jsonData)
End Sub
Below is the content from the API documentation
-----------------------------------------
Authentication and token exchange:
Once the request_token is obtained from the login flow, it should be POSTed to /session/token to complete the token exchange and retrieve the access_token.
curl https://api.kite.trade/session/token \
-H "X-Kite-Version: 3" \
-d "api_key=xxx" \
-d "request_token=yyy" \
-d "checksum=zzz"
----------------------------------
I tried below VBA code and it is giving me "Missing or bad request parameters or values" error. Is my URL conversion from API document is valid?
Sub doLogin()
Dim api As String, requestToken As String, checksum As String, fullData As String, URL As String, jsonData As String
Dim JSON As Object
api = ThisWorkbook.Sheets("Login").Range("B1").Value
requestToken = ThisWorkbook.Sheets("Login").Range("B2").Value
checksum = ThisWorkbook.Sheets("Login").Range("B4").Value
URL = "https://api.kite.trade/session/token"
fullData = "X-Kite-Version: 3" & "api_key=" & api & "request_token=" & requestToken & "checksum=" & checksum
'
jsonData = CallPostMethod(URL, fullData)
MsgBox jsonData
Set JSON = JsonConverter.ParseJson(jsonData)
End Sub