RajeshKumar_
RajeshKumar_

Reputation: 151

Watson Visual Recognition error code 400

I am trying to classify an image and following this doc. Here is my cURL command :

curl -X POST -F "images_file=~/fish.jpg" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?api_key=12fdsxxxxxxxsadasdxxxxxxdsa45654&version=2016-05-20"

I am getting this response from the Watson:

{
  "error" : {
     "code": 400,
     "description": "No images were specified.",
     "error_id": "input_error"
  },
  "images_processed":0
}

My image is in C:/User/Rajesh Kumar/ and cURL is executing in Rajesh Kumar@RAJESH_KUMAR ~. I know the problem is in the cURL command but don't know what. Please help me to solve this problem.

Thanks in advance!

Upvotes: 1

Views: 1014

Answers (1)

joe
joe

Reputation: 2488

Make sure you are in the same directory as fish.jpg. Then run this command (replace API Key):

curl -X POST -F "[email protected]" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?api_key={api-key}&version=2016-05-20"

Don't use the tilda.


Just tried it out and it worked--here are the steps:

Step 1:

Download this file, and save it as fish.jpg:

fish.jpg

Step 2:

Make sure you're in the right directory:

terminal

Step 3:

Replace your API Key in this command and run it:

curl -X POST -F "[email protected]" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?api_key={api-key}&version=2016-05-20"

Step 4:

☺ ☺ ☺

money

Upvotes: 1

Related Questions