Reputation: 31
I'm just starting with cURL, I'm using Watson Natural Language Understanding (NLU) Service.. the following line gives me error code:400 "Invalid Request, content is Empty"
Note: I'm a Windows User
Your help is greatly appreciated!
All I'm trying to do is this simple Getting Started Example
curl -X POST -u "apikey:{MY_API_KEY}" ^
"https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2018-11-16" ^
Upvotes: 0
Views: 1725
Reputation: 26
Hey @mohsen the body is missing in the above Post request, A sample request would look something like this for Keywords on a text, Also replace API-KEY in the below curl request. It is not ideal to post API Keys in public sites
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"
}'
Upvotes: 1