2017-05-23 92 views
0

我正在嘗試創建一個環境以開始使用在Bluemix中創建的我的Watson發現服務。爲Watson Discovery API創建環境

繼上手我進入這個代碼文檔(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 - " }

當我在瀏覽器中鍵入鏈​​接並手動輸入憑據時,我不會收到任何錯誤。

有些身體能理解這個錯誤並能幫助我嗎?

提前感謝和問候

依米娜

回答

0

你確定你是提供搜索服務的憑據?如果您接着檢查您是否有正確的用戶名和密碼。

當您訪問發現服務時,請使用名稱:服務憑證

用這些值替換usernamepassword

見一個例子訪問:

enter image description here

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" 
+0

是..我相信,我用正確的憑據更換! –

+0

檢查我的編輯和我最後的捲曲 –

+0

嘗試用最後的捲曲我得到以下錯誤: 捲曲:(3)非法端口號 捲曲:(3)非法端口號 捲曲:(3)[通配符]第7列中的無與倫比的緊固支架/支架 { 「code」:400, 「error」:「意外標記」「 } –