我创建了一个以下shell脚本:
curl -X POST -u "my username" \
"https://gateway-lon.watsonplatform.net/natural-language-understanding/api/blah-blah-blah..." \
--header "Content-Type: application/json" \
--data '{
"url": "http://.../screenplay.txt",
"features": {
"sentiment": {},
"categories": {},
"concepts": {},
"entities": {},
"keywords": {}
}
}'
然后它问我“为用户输入主机密码”,我做了。
结果:{“code”:401,“error”:“Unauthorized”}
我键入了IBM帐户的密码。也许我必须为API创建另一个?
请参阅API文档 - https://cloud.ibm.com/apidocs/natural-language-understanding#analyze-text
您将需要一个服务API密钥,您可以从IBM Cloud获取该密钥。服务文档中的入门教程向您展示了如何 - https://console.bluemix.net/docs/services/natural-language-understanding/getting-started.html#getting-started-tutorial