From 4f491fd9edddc5bdb46a2cdbb196bc78383ee13e Mon Sep 17 00:00:00 2001 From: Cristian Livadaru Date: Fri, 24 Apr 2015 16:34:09 +0200 Subject: [PATCH] describe image uploading --- app/views/pages/guides/restful-api.liquid.haml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/views/pages/guides/restful-api.liquid.haml b/app/views/pages/guides/restful-api.liquid.haml index 5c7053e..af165cb 100644 --- a/app/views/pages/guides/restful-api.liquid.haml +++ b/app/views/pages/guides/restful-api.liquid.haml @@ -61,6 +61,12 @@ listed: true curl -X POST -d 'page[title]=Hello world&page[slug]=hello-world&page[parent_fullpath]=index&page[raw_template]=Built with the API&page[listed]=true&page[published]=true' 'http:///locomotive/api/current_site.json?auth_token=K9zm8niKTxuM4ZMNK7Ct' + # 5. Upload a file + 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:///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 {% endblock %}