我想将此cURL调用(从CLI工作)转换为httr::POST(),以便于重用:
curl --data 'api_key=abc123' --data-urlencode 'event=[{"user_id":"u1", "event_type":"e_0224"}]' https://api.amplitude.com/httpapi
这是我最近一次使用httr :: POST()
的尝试params <- list()
params$api_key <- "abc123"
event <- list()
event$user_id <- "u1"
event$event_type <- "e_0224"
params$event <- event
r <- POST(url = "https://api.amplitude.com/httpapi",
body = params,
encode = "json")
我收到此错误:
httr::text_content(r)
[1] "missing_event"