watson对话API,从curl提供网关错误代码:ERCD04-INVLDCHR-USERID [英] watson conversation API giving Gateway Error Code : ERCD04-INVLDCHR-USERID from curl

查看:109
本文介绍了watson对话API,从curl提供网关错误代码:ERCD04-INVLDCHR-USERID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论是否仔细检查所有内容,我都会收到无效的用户ID错误.

I am getting an invalid userid error regardless of having checked everything carefully.

我正在发布一个非常简单的呼叫,其中包含从Bluemix中的对话服务获取的服务凭证和从对话服务中的特定工作空间获取的工作空间ID.

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.

我想念什么?

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"

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>

<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>

推荐答案

我是Watson Conversation项目的开发人员之一,看来您在访问/conversation/api/v1/workspaces/SERVICE-GUID/message端点方面取得了一些成功,但是很少出现401错误,这意味着请求是未经授权的.

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拒绝了您的请求,因为用户名和密码无效.我不确定100%,但是您是否将{}作为卷曲请求的一部分发送?例如,如果您的用户名是my-username,密码是swordfish,那么您应该发送:

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\}}"
请注意单词"Hello"周围的斜角引号

"{\"input\": {\"text\": \"Hello\"}}"
note the angled quotes around the word "Hello"

如果不确定用户名和密码应该是什么,可以通过转到Bluemix上的服务实例页面,然后单击左侧的凭证链接来获取它们.

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.

这篇关于watson对话API,从curl提供网关错误代码:ERCD04-INVLDCHR-USERID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆