Watson dialog cURL conversation post request not passing form data

你说的曾经没有我的故事 提交于 2019-11-29 17:13:15

The service expects an application/x-www-form-urlencoded POST request

To do that in curl you need to use the -d parameter:

curl -u "USERNAME":"PASSWORD" -X POST 
  -d conversation_id=CONVOID 
  -d client_id=CLIENTID
  -d input="What type of toppings do you have?"
  "https://gateway.watsonplatform.net/dialog/api/v1/dialogs/DIALOGID/conversation"

-d, --data

(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to -F, --form.

Curl documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!