diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2017-04-22 14:06:35 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2017-04-22 14:08:09 +0200 |
commit | f5dcf75075c013bbfdf9cdb6716afee777620c73 (patch) | |
tree | 26772aa9f5f288bf7fba044b995c1fc28c5a5476 /fbin/templates/help.html | |
parent | 8e44431e5b34c2e647c339f332cea32d44797951 (diff) |
Added upload API.
Also updated the API (previously help) page.
Diffstat (limited to 'fbin/templates/help.html')
-rw-r--r-- | fbin/templates/help.html | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/fbin/templates/help.html b/fbin/templates/help.html deleted file mode 100644 index 899cd78..0000000 --- a/fbin/templates/help.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends "base.html" %} -{% block content %} -<div class="alert alert-danger"> - <h2> - <span class="glyphicon glyphicon-alert" aria-hidden="true"></span> - TODO: Update this page. - </h2> -</div> -<div class="alert alert-warning"> - <span class="glyphicon glyphicon-alert" aria-hidden="true"></span> - Everything below this point is outdated and should be disregarded until further notice. -</div> -<s> -<p>Usage: POST to <a href="$scheme://${host}${settings.virtual_root}u">$scheme://${host}${settings.virtual_root}u</a> with filedata given to "file" and original filename to "filename". Login is done by generating a login token and sending it as the cookie "token".</p> -<p>cURL examples, <code>get_token</code>: -<blockquote><pre><code>$ curl $scheme://${host}${settings.virtual_root}a?method=get_token -F username=foo -F password=bar -{"status": true, "message": null, "method": "get_token", "token": "cb42eb38eb516d9dfcaaa742d1da0b3ad454b2bd05a8b4daa6d01e9587d7c759"}</code></pre></blockquote> -Upload using the token: -<blockquote><pre><code>$ curl -b 'token=cb42eb38eb516d9dfcaaa742d1da0b3ad454b2bd05a8b4daa6d01e9587d7c759' -F 'file=@image.png' -F 'filename=image.png' -F 'api=1' $scheme://${host}${settings.virtual_root}u -OK sjLUD</code></pre></blockquote> -To expire the current token: -<blockquote><pre><code>$ curl $scheme://${host}${settings.virtual_root}a?method=expire_token -F token=cb42eb38eb516d9dfcaaa742d1da0b3ad454b2bd05a8b4daa6d01e9587d7c759 -{"status": true, "message": null, "method": "expire_token"}</code></pre></blockquote> -If you get HTTP 417 responses, try adding:<code>-H 'Expect:'</code>.</p> -<p>By adding the key-value pair "api=1" you will get machine-readable responses in the form: <code>response result</code> where <code>response</code> is either <code>ERROR</code> or <code>OK</code>, -and <code>result</code> is the file hash in the case of <code>OK</code>, or an error message in the case of <code>ERROR</code> (see example above). -The hash can be used to construct URLs in which the paths begin with <code>/f/hash</code> where <code>hash</code> is the hash received.</p> -<p>Any file extension an be appended to the hash, and for convenience the original filename (or whatever filename you prefer) can be appended after an additional slash after the hash.</p> -</s> -{% endblock %} |