I am getting an invalid userid error regardless of having checked everything carefully.
I am posting a very simple call with service credentials taken from the conversation service in Bluemix and workspace ID taken from the specific workspace within the conversation service.
What am I missing?
curl -X POST \
-u "{XXXXXXXXXXXXXXXXXXXXXXX}":"{XXXXXXXXX}" \
-H "Content-Type:application/json" \
-d "{\"input\": {\"text\": \”Hello\”}}" "https://gateway.watsonplatform.net/conversation/api/v1/workspaces/1db1f0a0-638e-4a27-bbf3-3117b308a727/message?version=2016-07-11"
I keep getting this error. Tips welcome
<HTML><HEAD><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><TITLE>Watson Error</TITLE></HEAD><BODY><HR><p>Invalid access to resource - /conversation/api/v1/workspaces/1db1f0a0-638e-4a27-bbf3-3117b308a727/message?version=2016-07-11</p><p>User access not Authorized.</p><p>Gateway Error Code : ERCD04-INVLDCHR-USERID</p><p>Unable to communicate with Watson.</p><p>Request URL : https://158.85.132.88:443/conversation/api/v1/workspaces/1db1f0a0-638e-4a27-bbf3-3117b308a727/message?version=2016-07-11</p><p>Error Id : gateway-dp01-928752884</p><p>Date-Time : 2016-09-20T08:56:03-04:00</p></BODY></HTML>
I'm one of the developers on the Watson Conversation project, and it looks like you're having some success with the accessing the /conversation/api/v1/workspaces/SERVICE-GUID/message
endpoint, but have some infrequent 401 errors, which means the request was unauthorized.
Watson is rejecting your request because on an invalid username and password. I'm not 100% certain, but are you sending the {}
as part of your curl request? For example if your username was my-username
and your password is swordfish
then you should send:
curl -X POST -u "my-username:swordfish" -H "Content-Type:application/json" -d '{"input": {"text": "Hello"}}' "https://gateway.watsonplatform.net/conversation/api/v1/workspaces/1db1f0a0-638e-4a27-bbf3-3117b308a727/message?version=2016-07-11"
Also, looking through your request, it appears that you have some left and right directed quotation marks in your request, this might be an artifact of cutting and pasting your request from somewhere else, but those will generate an error once you get the username and password to work.
"{\"input\": {\"text\": \”Hello\”}}"
note the angled quotes around the word "Hello"
If you're unsure of what your username and password should be, you can get them by going to your service instance page on Bluemix and then clicking on the credentials link on the left hand side.