繁体   English   中英

为Watson Discovery API创建环境

[英]Create Environment for Watson Discovery API

我正在尝试创建一个环境,以开始使用在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 - " }

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

某些人能理解这个错误并且可以帮助我吗?

在此先感谢您,最好的问候

依米娜

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

当您访问Discovery Service时,请使用名称选项: Service Credentials

用这些值替换usernamepassword

参见以下示例以访问:

在此处输入图片说明

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"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM