IBM Watson - Conversation API integration returns Resource Not Found error (404)

a 夏天 提交于 2019-12-01 05:48:57

问题


I am trying to integrate watson from salesforce (Http Callout) and received 404 error. Then I tried the sameusing Postman tool but getting the same result

Added conversation credentials in request header

Request Endpoint

https://gateway.watsonplatform.net/conversation/api/v1/workspaces/883c7704-02c4-41fc-b8a0-aea1d0325c5a/message?version=2016-09-20

Request Body

{
  "application/json": {
    "input": {
      "text": "Hi"
    },       
    "alternate_intents": true
  }
}

Response Body

{
  "error": "Resource not found"
}

Status 404 Not found

Please let me know what is the issue here. I am not sure whether the way I added version and workspace id in the endpoint went wrong


回答1:


The request body doesn't seem right. It should be JSON with e.g. this structure (see api ref. page in watson conversation service doc.):

{
  "input": {
    "text": "Hi"
  }
}

application/json should be the content type. Sample request with curl:

curl -X POST -u "{username}":"{password}" -H "Content-Type:application/json" --data "{\"input\": {\"text\": \"Hi\"}}" "https://gateway.watsonplatform.net/conversation/api/v1/workspaces/<workspace_id>/message?version=2017-02-10"

See the API Reference for more details: https://www.ibm.com/watson/developercloud/conversation/api/v1/




回答2:


I had the same issue and I found that it's simply rate limiting that kicks in.

According to the docs here there is no limit for the endpoint, however that turns out to be untrue. If you send a few thousand messages in quick succession, you'll start getting 404 Not Found until the quota resets, which seems to take around 1 hour.



来源:https://stackoverflow.com/questions/42222095/ibm-watson-conversation-api-integration-returns-resource-not-found-error-404

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