1
我正嘗試使用POST方法向API進行認證。這裏是我所指的文件Kite Connect API。 我無法理解我出錯的地方。錯誤與校驗和或POST有關嗎?使用帶響應鍵和校驗和的REST API進行POST認證
library(digest)
require("httr")
my_api <- "xxx"
my_req_token <- 'yyy'
my_secret <- 'zzz'
check<-hmac(my_req_token,paste0(paste0(my_api,my_req_token),my_secret),algo=c('sha256'))
url <- 'https://api.kite.trade/session/token'
login <- list(api_key=my_api,
request_token = my_req_token,
checksum = check)
response<- POST(url,body= login)
這是我收到的回覆。
> response
Response [https://api.kite.trade/session/token]
Date: 2017-08-27 12:34
Status: 400
Content-Type: application/json
Size: 81 B
> content(response, "parsed", "application/json")
$status
[1] "error"
$message
[1] "Missing api_key"
$error_type
[1] "InputException"
'> RESP [[1]] 函數() HTTR :: VERB(動詞=「GET」,url =「https://api.kite.trade/session/token」) <環境:0x0000000011ed3618>' –
這是我從代碼中得到的迴應。 *爲校驗和添加了hmac –