when I try to curl the following (obviously replaced the username, pw, and dialog id)
curl -u "username":"password" -X POST --form input="hi watson" "https://gateway.watsonplatform.net/dialog/api/v1/dialogs/dialog-id/conversation"
I get
{"conversation_id":xxxxxx,"client_id":xxxxxx,"input": "","confidence":-1.0,"response":["Hi, I'm Watson! I can help you order a pizza, what size would you like?"]}
When I try to send another request with the appropriate client ID, conversation ID and new input it returns the same response with an empty input. When I run my xml in watson's dialog tool provided through github I get another answer.
From my understanding the input should show what I sent over. Any ideas why this is not getting processed?
This is a duplicate of this question. I will write the same answer until we close this.
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=conversation-id
-d client_id=client-id
-d input="What type of toppings do you have?"
"https://gateway.watsonplatform.net/dialog/api/v1/dialogs/dialog-id/conversation"
-d, --data
Make sure you replace the command with your credentials and dialog-id
, conversation-id
and client-id
.
(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.