diff options
Diffstat (limited to 'templates')
| -rw-r--r--[l---------] | templates/api.html | 114 | ||||
| -rw-r--r-- | templates/cli.html | 2 | ||||
| -rw-r--r-- | templates/header.html | 1 | ||||
| -rw-r--r-- | templates/index.html | 3 |
4 files changed, 116 insertions, 4 deletions
diff --git a/templates/api.html b/templates/api.html index 7b03479..a88e584 120000..100644 --- a/templates/api.html +++ b/templates/api.html @@ -1 +1,113 @@ -cli.html
\ No newline at end of file +{{template "header.html" "Upload images from file!"}} +{{template "navbar.html"}} +{{template "modal_uploaded.html"}} +{{template "modal_error.html"}} + +<div class="container"> + <div class="row"> + <div class="col-md-12 well"> + + <h1>Rest API:</h1> + <p>Interfacing with Mandible is extremely simple:</p> + <p></p> + + <blockquote> + <h2>Upload an image file:</h2> + <p><code>POST {{.OriginUrl}}/api/v1/file</code></p> + <p>with the following multi-part/form-data</p> + <ul> + <li><code>image</code> - file</li> + </ul> + </blockquote> + + <blockquote> + <h2>Upload an image from a URL:</h2> + <p><code>POST {{.OriginUrl}}/api/v1/url</code></p> + <p>with the following multi-part/form-data</p> + <ul> + <li><code>image</code> - file</li> + </ul> + </blockquote> + + <blockquote> + <h2>Upload an image from base64 data:</h2> + <p><code>POST {{.OriginUrl}}/api/v1/base64</code></p> + <p>with the following multi-part/form-data</p> + <ul> + <li><code>image</code> - image encoded as base64 data</li> + </ul> + </blockquote> + + <blockquote> + <h2>Thumbnail Generation:</h2> + <p>To generate thumbnails with the request, pass the following JSON as form-data, keyed under <code>thumbs</code></p> + <pre><code>{ + "name1": { + "width": x, + "height": y, + "shape": ("square" | "thumb" | "circle") + }, + "name2": { + "width": x2, + "height": y2, + "shape": ("square" | "thumb" | "circle") + }, + ... +}</code></pre> + <p>Note: Square thumbnails don't preserve aspect ratio, whereas the 'thumb' type does.</p> + </blockquote> + + <h1>Example Usage:</h1> + <blockquote> + <h2>URL Upload with thumbnails:</h2> + <pre><code>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"}}'</code></pre> + + <h2>Response:</h2> + <pre><code>{ + "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 +}</pre></code> + </blockquote> + + <blockquote> + <h2>File Upload with thumbnails:</h2> + <pre><code>curl -i {{.OriginUrl}}/api/v1/file \ +-F 'image=@/tmp/cat.gif' \ +-F 'thumbs={"small": {"width": 20, "height": 20, "shape": "square"}}'</pre></code> + + <h2>Response:</h2> + <pre><code>{ + "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 +}</pre></code> + </blockquote> + </div> + </div> +</div> + +{{template "footer.html"}} diff --git a/templates/cli.html b/templates/cli.html index d6dfa84..9d50adb 100644 --- a/templates/cli.html +++ b/templates/cli.html @@ -5,7 +5,7 @@ <div class="container"> <div class="row"> - <div class="col-md-12"> + <div class="col-md-12 well"> <h1>TODO!</h1> diff --git a/templates/header.html b/templates/header.html index 2e0b604..8269f3d 100644 --- a/templates/header.html +++ b/templates/header.html @@ -13,6 +13,5 @@ <link rel='stylesheet' type='text/css' href='/static/css/style.css'> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <link rel='shortcut icon' type='image/png' href='/static/img/favicon.ico'> - <!--noscript><style>.navbar{margin-bottom:0;}.noscript{margin-bottom:20;}</style></noscript--> </head> <body> diff --git a/templates/index.html b/templates/index.html index 21180b7..44f6ace 100644 --- a/templates/index.html +++ b/templates/index.html @@ -61,7 +61,8 @@ <i class="fa fa-exchange"></i> REST-Like API</h2> - <p><strong>TODO:</strong> Read the documentation here.</p> + <p>We provice a interface for easy access without your web browser. <br> + <a href="/api" title="API Documentation" class="btn btn-material-indigo-A700"><span class="fa fa-info-circle"></span> Read here more! »</a></p> </div> </div> <div class="row"> |
