AnsweredAssumed Answered

cURL kickstart needed, please!

Question asked by 34South on Apr 4, 2018
Latest reply on Apr 5, 2018 by wimdecorte

I'm a long time FM developer, but a total novice with regard to APIs and the, relatively, new cURL option.

I'm trying to communicate with the Clarifai service (machine learning of image data) but can't get past go.

Any help would end days of searching, watching instructional videos and failed attempts and I apologise in advance for such a basic question.

 

As a simple example to get me on to my learning curve (I've tried more complex ones related to uploading images and associated tags), my cURL header option to create a model for image learning is:

 

curl -X POST \ <do I even need this, doesn't the insert from URL cover this?>

-H "Authorization: Key ########################" \ <hashes are my API key which works via their web based explorer app>

-H "Content-Type: application/json" \

-d '

{

   "model": {

        "id": "MODEL" <MODEL is the name of the model I want to create>

    }

}' \

 

My $url is https://api.clarifai.com/v2/models (as indicated by the site for creating a new model) and target the $$json variable. SSL is on.

 

Their required format is as follows where YOUR_API_KEY is the user API key and "petsID" is the example model they are giving as an example:

 

-X POST \ -H "Authorization: Key YOUR_API_KEY" \

-H "Content-Type: application/json" \

-d '

{

    "model": {

        "id": "petsID" }

}'\

 

When my header text is dropped into the Data Viewer, the result is <Table Missing>, so clearly the format is incorrect.

Whatever I do, and I've tried everything I can think of, I always get the following response in my $$json variable:

{"status":{"code":11102,"description":"Invalid request","details":"Malformed or invalid request"}}

 

HELP!

Outcomes