Watson dialog cURL conversation post request not passing form data

后端 未结 1 1999
南方客
南方客 2020-12-22 01:38

When making a post cURL request as below to try and continue a created conversation watson instead returns a new conversation.

curl -u \"USERNAME\":\"PASSWOR         


        
相关标签:
1条回答
  • 2020-12-22 02:00

    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

    0 讨论(0)
提交回复
热议问题