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 –