From 7a5d729859a2f667658532303c2616a38f781dd2 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 26 Feb 2011 22:39:22 +0100 Subject: Added some requests, more details in long description. - Files are now hashed, when you upload a file with an existing hash you will get the existing file in return (will fix adding files to your account at a later time). - Username can be used instead of uid for cookies, hashing for the identifier works the same way as before, but with username instead of uid if username is used. - Add api=1 to get machine-readable responses, details in are found on the help page. --- templates/help.tmpl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'templates') diff --git a/templates/help.tmpl b/templates/help.tmpl index 5dc096f..bdf95d4 100644 --- a/templates/help.tmpl +++ b/templates/help.tmpl @@ -3,9 +3,21 @@ #extends templates.base #def content

Usage: POST to $scheme://$host/u with filedata given to "file" and original filename to "filename". - Login is sent by cookies with user id in "uid" and an identifier which is sha1(uid+sha1(password)).

+ Login is sent by cookies with either: + + or + +

cURL example: - curl -b 'uid=42; identifier=360b411581c3d516c8d55c290f039b144cea79ad' -F 'file=@image.png' -F 'filename=image.png' http://myhost/u +

curl -b 'uid=42; identifier=360b411581c3d516c8d55c290f039b144cea79ad' -F 'file=@image.png' -F 'filename=image.png' -F 'api=1' http://myhost/u
Here user id is 42 and the password is "foobar". - If you get HTTP 417 responses, try adding:-H 'Expect:'

+ If you get HTTP 417 responses, try adding:-H 'Expect:'.

+

By adding the key-value pair "api=1" you will get machine-readable responses in the form: response result where response is either ERROR or OK, + and result is the file hash in the case of OK, or an error message in the case of ERROR. + The hash can be used to construct URLs in which the paths begin with /f/hash where hash is the hash received.

+

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.

#end def -- cgit v1.2.3