0

我正在尝试创建一个环境以开始使用在 Bluemix 中创建的 Watson Discovery Service。

按照入门文档,我输入了此代码(在 cmd 中):

curl -X POST -u "{username}":"{password}" -H "Content-Type: application/json" -d '{ "name":"my-first-environment", "description":"exploring environments", "size":0}' "https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2016-12-01"

我确保我输入了正确的服务凭据,但我收到了这个我不明白的错误:

{ "code" : 401 , "error" : "Not Authorized" , "description" : "2017-05-23T08:53:35-04:00, Error ERCDPLTFRM-INVLDCHR occurred when accessing https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2016-12-01, Tran-Id: gateway-dp02-1408488112 - " }

当我在浏览器中键入链​​接并手动输入凭据时,我没有收到任何错误。

是否有人理解这个错误并可以帮助我?

提前致谢并致以最诚挚的问候

埃米拉

4

1 回答 1

0

您确定要提供发现服务凭据吗?如果您然后检查您的用户名和密码是否正确。

当您访问 Discovery Service 时,有一些名称为:Service Credentials的选项。

usernameand替换为password这些值。

查看一个示例以访问:

在此处输入图像描述

curl -X POST -u "USERNAME":"PASSWORD" -H "Content-Type: application/json" -d '{ "name":"my-first-environment", "description":"exploring environments", "size":0}' "https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2016-12-01"

编辑:

 curl -X POST -u "{username}":"{password}" -H "Content-Type: application/json" -d '{ "name": "test_collection", "description": "My test collection", "configuration_id": "{configuration_id}" }' "https://gateway.watsonplatform.net/discovery/api/v1/environments/{environment_id}/collections?version=2016-12-01"
于 2017-05-23T13:50:09.523 回答