curl command for NLC tutorial

277 views Asked by At

While executing the curl command for training as give in the tutorial

curl -i -u "5731de06-c553-4ef7-a8ff-33bd0229c8e3":"H0fCVUwrEito" \ -F training_data=@/F:/Old PC data/Tejal_Data/TITL/IBM_Bluemix/techm_data_train.csv \ -F training_metadata="{\"language\":\"en\",\"name\":\"TutorialClassifier\"}" \ "https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers"

I get the following error

C:\curl-7.49.1-win64-mingw\bin>curl -i -u "5731de06-c553-4ef7-a8ff-33bd0229c8e3" :"H0fCVUwrEito" \ curl: (6) Could not resolve host: \

C:\curl-7.49.1-win64-mingw\bin>-F training_data=@/F:/Old PC data/Tejal_Data/TITL /IBM_Bluemix/techm_data_train.csv \ '-F' is not recognized as an internal or external command, operable program or batch file.

C:\curl-7.49.1-win64-mingw\bin>-F training_metadata="{\"language\":\"en\",\"name \":\"TutorialClassifier\"}" \ '-F' is not recognized as an internal or external command, operable program or batch file.

C:\curl-7.49.1-win64-mingw\bin>"https://gateway.watsonplatform.net/natural-langu age-classifier/api/v1/classifiers" The filename, directory name, or volume label syntax is incorrect.

C:\curl-7.49.1-win64-mingw\bin>

1

There are 1 answers

2
Daniel Toczala On

Your curl syntax is a bit off. Here is the pattern that I use:

curl -i -u {service_username}:{service_password} -F training_data=@{path_here}/{training_file}.csv -F training_metadata="{\"language\":\"en\",\"name\":\"{classifier_name\"}" https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers

In the example above, you would swap in the service username (5731de06-c553-4ef7-a8ff-33bd0229c8e3) for {service_username}, the service password (H0fCVUwrEito) for {service_password} , and so on. So I think that your curl command would look like this:

curl -i -u 5731de06-c553-4ef7-a8ff-33bd0229c8e3:H0fCVUwrEito -F training_data=@/F:/Old PC data/Tejal_Data/TITL /IBM_Bluemix/techm_data_train.csv -F training_metadata="{\"language\":\"en\",\"name\":\"TutorialClassifier\" https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers

This is all assuming that you have already established a Bluemix account and have created the NLC instance in question with that username and password.

One other thing, the errors that you show seem to indicate that there are CR/LF's in your script, and that each line is being input individually. The entire line of curl needs to be entered without any CR/LF's.