diff options
author | clsr <clsr@clsr.net> | 2016-06-16 02:19:44 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2016-06-16 02:19:44 +0200 |
commit | d1d96e35472f692ace7b08822d185f14913e0ea9 (patch) | |
tree | 83ca1bca75a0634436328a924afe7f3a9f409e45 /pomf-standard.txt | |
download | gomf-d1d96e35472f692ace7b08822d185f14913e0ea9.tar.gz gomf-d1d96e35472f692ace7b08822d185f14913e0ea9.zip |
Initial commit
Diffstat (limited to 'pomf-standard.txt')
-rw-r--r-- | pomf-standard.txt | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/pomf-standard.txt b/pomf-standard.txt new file mode 100644 index 0000000..f623d87 --- /dev/null +++ b/pomf-standard.txt @@ -0,0 +1,57 @@ +Upload API endpoint: + /upload.php + + +POST arguments: + files[]: + Content-Type: multipart/form-data + File to upload; multiple values supported. + + +GET arguments: + output: + gyazo: + Content-Type: text/plain + Complete URLs to uploaded files in the same order as the input files, separated by newlines. Does not have a trailing newline (Pomf1 compat version). + Example output: 'https://example.com/foobar.jpg\nhttps://example.com/qweasd.txt' + + text: + Content-Type: text/plain + Complete URLs to uploaded files in the same order as input files. Each line ends in a newline (Unix style). + Example output: 'https://example.com/foobar.jpg\nhttps://example.com/qweasd.txt\n' + Protip: if you include input names of uploaded files, how do you handle e.g. newlines in filenames? + + html: + Content-Type: text/html + A HTML page containing links to uploaded files. Can be anything and is primarily meant to be shown to a human user. + Example output: '<a href="https://example.com/foobar.jpg">https://example.com/foobar.jpg</a><br /><a href="https://example.com/qweasd.txt">https://example.com/qweasd.txt</a><br />' + + json: + Content-Type: application/json + Schema: + { + "success": bool /* true if everything is okay, false if there was an error */, + "errorcode": int /* only if success=false, the HTTP error code */, + "description": string /* only if success=false, the error message */, + "files": [ + { + "name": string /* original filename sent by the client */, + "url": string /* the complete URL to the uploaded file */, + "hash": string /* the SHA-1 hash of the uploaded file */, + "size": int /* the bytesize of the uploaded file */ + } + ] /* only if success=true, info about uploaded files in the same order they were uploaded */ + } + Clients *must not* assume a specific ordering of keys in objects nor any presence/absence of whitespace (outside strings); regex is not a good way to parse this. + Example output: '{"success": true, "files": [{"name": "cat.jpg", "url": "https://example.com/foobar.jpg", "hash": "8d26e24aabb26c02b5c9a9e102308af2a3597a49", "size": 44294}, {"name": "file.txt", "url": "https://example.com/qweasd.txt", "hash": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "size": 0}]}' + + csv: + Content-Type: text/csv + A CSV document listing the name, url, hash and size of uploaded files (same meanings as in the JSON response). + Dialect: delimiter=',', quotechar='"' + Headers are written on the first line. + Example output: 'name,url,hash,size\ncat.jpg,https://example.com/foobar.jpg,8d26e24aabb26c02b5c9a9e102308af2a3597a49,44294\nfile.txt,https://example.com/qweasd.txt,da39a3ee5e6b4b0d3255bfef95601890afd80709,0\n' + + +Rationale: + Such an API would provide the maximum compatibility with Pomf1 and Pomf2 while still implementing all the important features. |