1

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!

joe
  • 2,468
  • 2
  • 12
  • 19
Algor7
  • 149
  • 1
  • 14
  • Even i tried 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" but no help – Algor7 Jul 15 '16 at 07:29

1 Answers1

1

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

curl -X POST -F "images_file=@fish.jpg" "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 "images_file=@fish.jpg" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?api_key={api-key}&version=2016-05-20"

Step 4:

☺ ☺ ☺

money

joe
  • 2,468
  • 2
  • 12
  • 19
  • 1
    Thanks it is working now. The problem was I was in wrong directory and using tilde(~) rather than @. – Algor7 Jul 15 '16 at 16:42