I'm trying to figure out how to do the following with httr::POST
curl -X POST -u "apikey:{apikey}" --header "Content-Type:application/json" --data "{\"input\": {\"text\": \"Hello\"}}" "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/{workspace_id}/message?version=2018-09-20"
In the past I have used httr::authenticate(username,password)
like follows:
conv.init <- httr::POST(url=paste(url,"/workspaces/",workspace,"/message",version,sep=""),
httr::authenticate(username,password),
httr::add_headers("Content-Type"="application/json"),
body = '{ "input": { "text":""},
"system":{ "dialog_stack":["root"]},
"dialog_turn_counter":1,
"dialog_request_counter":1}',
encode = "json")
How can I pass an api key instead of a user name and password?
Thanks!