Using the Locomotive Restful API with CURL

Warning, this a rather old article I am moving over from an old blog, it might be deprecated.

I sill skip the token creation and jump right to the part using curl. If you need the login and token part as well, you can find them in the locomotive guides.

Assuming we have a content type “gallery_item” with a name:string and foto:file field. To upload a image with curl via the API:

curl -i -F entry[name]=Foto1 -F foto=@image.png -X POST 'http://yoursite/locomotive/api/content_types/gallery_item/entries.json?auth_token=K9zm8niKTxuM4ZMNK7Ct'

This will create a new entry in “GalleryItem” with the name “Foto1” and attach the local file image.png

Like what you read? Give Cristian Livadaru a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.