-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAPI
More file actions
83 lines (67 loc) · 1.99 KB
/
API
File metadata and controls
83 lines (67 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
BRIEF API DOCUMENTATION
=======================
- All requests require POST, even 'last'.
- The URL is /api/[method]/[api_key], where /[api_key] is not mandatory. If you
don't specify api_key or you specify a wrong one, you will have the same
rights as a non-logged in user in the website: you can't read hidden quotes
and you can't post a quote without being reviewed first.
- POST variables marked with * are mandatory.
METHODS
=======
send
----
Variables:
- *nick
- *text
- comment
- hidden: 1, 0, true or false, whether the quote will be hidden or not.
Returns:
- url: URL of the new quote, this is, domain + permaid.
- permaid: permaid of the new quote.
This method may not fail, it doesn't check whether the params are empty or whether
they are too long; it will truncate long nicks/comments depending on the limits
defined in include/defines.php
last
----
Variables:
- none
Returns:
- url: URL of the last quote, this is, domain + permaid.
- permaid: permaid of the last quote.
read
----
Variables:
- *permaid
Returns:
- data (array):
- permaid
- nick
- date
- ip: may be partially or completely hidden depending on the site configuration.
- comment: may be empty.
- hidden: whether the quote is hidden or not; true or false.
- ts: quote's unix timestamp.
- new: whether the quote has been sent to the site in the latest 24 hours; true or false.
- timelapse: human readable time lapse.
- status: 'pending' or 'approved'.
search
------
Variables:
- *criteria: using * and ? wildcards; example: "l?l" or "are*sure".
- page: results page.
- page_size: how many quotes per page.
For instance, to read quotes 16-20, use page=4 and page_size=5.
Returns:
- data (array), with the same parameters as in the 'read' method.
- count: number of results.
delete
------
Variables:
- *permaid
Requires a valid API key.
topic
-----
Variables:
- *topic
- nick: nick of the user who set it
Requires a valid API key. This method may not fail if the API key was correct.