Created API (markdown)
parent
6addef2f27
commit
eac00ac4f6
18
API.md
Normal file
18
API.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
ZeroBin uses AJAX requests for certain operations. While not yet fully developed into a standards compliant REST or JSON-RPC, it is documented here for reference.
|
||||||
|
|
||||||
|
The query strings below would be appended after the `?` in the URL, i.e. query string `foo` on the site URL of `https://example.com/zerobin/` would become `https://example.com/zerobin/?foo`.
|
||||||
|
|
||||||
|
Action | Type | Query String | Data to send (JSON) | Result (JSON)
|
||||||
|
------------------------------------|------|--------------|---------------------|--------------
|
||||||
|
retrieve paste (and its comments) | GET | `[pasteID]&json` | (no data) | `{"status":0, "id":"[pasteID]"}`
|
||||||
|
create paste | POST | (empty query string) | `{"data":"[cipherdata]", "expire":"[expireID]", "burnafterreading":[1/0], "opendiscussion":[1/0]}` | `{"status":0, "id":"[pasteID]", "deletetoken":[token]}`
|
||||||
|
create comment | POST | (empty query string) | `{"data":"[cipherdata]", "parentid":"[parentID]", "pasteid":[pasteID], "nickname":[cipherdata]}` | `{"status":0, "id":"[pasteID]"}`
|
||||||
|
delete paste (only for burn after reading pastes) | GET | `pasteid=[pasteID]&deletetoken=burnafterreading` | (no data) | `{"status":0, "id":"[pasteID]"}`
|
||||||
|
Error on any of the above | N/A | N/A | N/A | `{"status":1, "message":"[errormessage]"}`
|
||||||
|
|
||||||
|
### Legend
|
||||||
|
|
||||||
|
[pasteID]: ID of the paste, 16 characters long, hexadecimal
|
||||||
|
[parentID]: ID of the comments parent (paste ID or comment ID), 16 characters long, hexadecimal
|
||||||
|
[cipherdata]: binary data, output of the encryption function
|
||||||
|
[expireID]: expiration key as defined in the [configuration file](https://github.com/elrido/ZeroBin/blob/master/cfg/conf.ini#L50) of the service
|
Loading…
Reference in New Issue
Block a user