{{template "header.html" "API documentation | Mandible"}} {{template "navbar.html"}} {{template "modal_uploaded.html"}} {{template "modal_error.html"}}
Interfacing with Mandible is extremely simple:
Upload an image file:
POST {{.OriginUrl}}/api/v1/filewith the following multi-part/form-data
image- file
Upload an image from a URL:
POST {{.OriginUrl}}/api/v1/urlwith the following multi-part/form-data
image- file
Upload an image from base64 data:
POST {{.OriginUrl}}/api/v1/base64with the following multi-part/form-data
image- image encoded as base64 data
Thumbnail Generation:
To generate thumbnails with the request, pass the following JSON as form-data, keyed under
thumbs{ "name1": { "width": x, "height": y, "shape": ("square" | "thumb" | "circle") }, "name2": { "width": x2, "height": y2, "shape": ("square" | "thumb" | "circle") }, ... }Note: Square thumbnails don't preserve aspect ratio, whereas the 'thumb' type does.
URL Upload with thumbnails:
curl -i {{.OriginUrl}}/api/v1/url \ -d 'image=http://i.imgur.com/s9zxmYe.jpg' \ -d 'thumbs={"small": {"width": 20, "height": 20, "shape": "square"}, "profile": {"width": 50, "height": 50, "shape": "circle"}}'Response:
{ "data": { "width": 380, "height": 430, "link": "{{.ResponseUrl}}/i/Y/h/Yhs6srW", "mime": "image/jpeg", "name": "", "size": 82199, "thumbs": { "profile":"{{.ResponseUrl}}/t/Y/h/Yhs6srW/profile", "small": "{{.ResponseUrl}}/t/Y/h/Yhs6srW/small" } }, "status": 200, "success": true }
File Upload with thumbnails:
curl -i {{.OriginUrl}}/api/v1/file \ -F 'image=@/tmp/cat.gif' \ -F 'thumbs={"small": {"width": 20, "height": 20, "shape": "square"}}'Response:
{ "data": { "width": 354, "height": 200, "link": "{{.ResponseUrl}}/i/U/v/UvfuzBW", "mime": "image/gif", "name": "cat.gif", "size": 3511100, "thumbs": { "small":"{{.ResponseUrl}}/t/U/v/UvfuzBW/small" } }, "status": 200, "success": true }