Skip to content
This repository has been archived by the owner on Apr 28, 2019. It is now read-only.

describe image uploading #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/views/pages/guides/restful-api.liquid.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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://<your site>/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 [email protected] -X POST 'http://<your site>/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 %}