无效请求:内容为空

Invalid Request : Content is Empty

我刚开始使用 cURL,我正在使用 Watson Natural Language Understanding (NLU) 服务。以下行给我错误 code:400 "Invalid Request, content is Empty"

注意:我是 Windows 用户

非常感谢您的帮助!

我要做的就是这个简单的入门示例

https://cloud.ibm.com/services/natural-language-understanding/crn:v1:bluemix:public:natural-language-understanding:us-south:a%2f1fdc918bf6c243fcb853ba8fb6907839:aaf7bfd6-ca63-431a-a143-e2cc863ebc6c::?paneId=gettingStarted

curl -X POST -u "apikey:{MY_API_KEY}" ^
"https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2018-11-16" ^

嘿@mohsen 在上面的 Post 请求中缺少正文,对于文本上的关键字,示例请求看起来像这样,还要替换下面的 curl 请求中的 API-KEY。 post API 键在 public 个站点

中不理想
curl -X POST \
 'https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2017-01-11' \
-u "apikey:<API-KEY>"\
 -H 'Content-Type: application/json' \
 -H 'cache-control: no-cache' \
 -d '{
   "text":"Iran Warns Of Retaliation If U.S. Breaches Nuclear Deal. Iran Supreme Leader Ayatollah Khamenei is warning that Tehran will retaliate if the sanctions are approved.",
   "features": {
       "keywords":{
           "sentiment":true

       }
   },
   "language":"en"

}'