Wiki source code of API V2.0
Version 10.1 by Treyfane Dingo on 2024/02/11 19:43
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | The L.A.S.S.I.E. API V 2.0 can be reached via | ||
2 | |||
3 | {{{https://api.lassie.online/v2.0}}} | ||
4 | |||
5 | === Required POST Parameters === | ||
6 | |||
7 | The parameters have to be send as **URLencoded form data**. The API needs at least two parameters to work: | ||
8 | |||
9 | * apikey | ||
10 | * request | ||
11 | * command (optional) | ||
12 | |||
13 | The API-Key has to be set in "System Settings" → "API Keys". Preferrably a longer and unique key (like a MD5SUM). An specific API key can only be used for a corresponding request type. | ||
14 | |||
15 | (% style="width:50%" %) | ||
16 | |=(% colspan="3" %)Requests and Commands | ||
17 | |=(% scope="col" %)Request|=Command|=Description | ||
18 | |(% rowspan="4" %)lostandfounddb|lostandfound|(Default) Returns all active (not returned) lost & found items from the Lost & Found Database | ||
19 | |lost|Returns all active (not returned) lost items from the Lost & Found Database | ||
20 | |found|Returns all active (not returned) found items from the Lost & Found Database | ||
21 | |returned|Returns all inactive / returned items from the Lost & Found Database | ||
22 | |briefings| |Returns all briefings (i.e. Security News) classified as PUBLIC | ||
23 | |||
24 | The request "lostandfounddb" without a command will return the active Lost & Found Database entries for the respective Convention as a JSON. This includes Links to the uploaded images. Thus, the information can be processed on an external Website, e.g. the convention's homepage. | ||
25 | |||
26 | === Example (CURL) === | ||
27 | |||
28 | {{{curl -X POST -d "apikey=ae629a834729fd3aac6d1f827b1793b0" -d "request=lostandfounddb" https://api.lassie.online/v2.0}}} | ||
29 | |||
30 | This example will display the entire Lost & Found Database of FTC. | ||
31 | |||
32 | {{{curl -X POST -d "apikey=ae629a834729fd3aac6d1f827b1793b0" -d "request=lostandfounddb" -d "command=lost" https://api.lassie.online/v2.0}}} | ||
33 | |||
34 | This example will display only the lost items of the Lost & Found Database of FTC. | ||
35 | |||
36 | === Test API Keys === | ||
37 | |||
38 | The API Keys for FurtherTestCon (FTC) are: | ||
39 | |||
40 | {{{ae629a834729fd3aac6d1f827b1793b2 Attendee Database | ||
41 | ae629a834729fd3aac6d1f827b1793b1 Operatives Database | ||
42 | ae629a834729fd3aac6d1f827b1793b0 Lost & Found Database | ||
43 | ae629a834729fd3aac6d1f827b1793b3 Briefings Database}}} | ||
44 | |||
45 | === Output === | ||
46 | |||
47 | The output of an valid request to the API will be a JSON-Object like the following examples: | ||
48 | |||
49 | ==== Lost & Found Database ==== | ||
50 | |||
51 | {{box}} | ||
52 | { | ||
53 | "data": [ | ||
54 | { | ||
55 | "id": 1925, | ||
56 | "image": null, | ||
57 | "thumb": null, | ||
58 | "title": "Image", | ||
59 | "description": "invisible, watercolour, found in Schroedinger's box", | ||
60 | "status": "F", | ||
61 | "lost_timestamp": null, | ||
62 | "found_timestamp": "2023-11-24 00:27:24", | ||
63 | "return_timestamp": null | ||
64 | }, | ||
65 | { | ||
66 | "id": 1921, | ||
67 | "image": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/fe3c6670a33d8f4199ffa95a5c23b622.png", | ||
68 | "thumb": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/thumbnail/fe3c6670a33d8f4199ffa95a5c23b622.png", | ||
69 | "title": "Sense of Taste", | ||
70 | "description": "lost in Hotel Restaurant", | ||
71 | "status": "L", | ||
72 | "lost_timestamp": "2023-11-01 16:13:02", | ||
73 | "found_timestamp": null, | ||
74 | "return_timestamp": null | ||
75 | }, | ||
76 | { | ||
77 | "id": 1920, | ||
78 | "image": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/bc7c343fb3807d4d41b7e04fa909aad5.png", | ||
79 | "thumb": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/thumbnail/bc7c343fb3807d4d41b7e04fa909aad5.png", | ||
80 | "title": "Vape", | ||
81 | "description": "black / rainbow, \"GEEKVAPE\", found at Open Stage", | ||
82 | "status": "F", | ||
83 | "lost_timestamp": null, | ||
84 | "found_timestamp": "2023-09-30 23:52:38", | ||
85 | "return_timestamp": null | ||
86 | } | ||
87 | ] | ||
88 | } | ||
89 | {{/box}} | ||
90 | |||
91 | (% style="width:50%" %) | ||
92 | |=(% colspan="3" %)Lost & Found fieldset | ||
93 | |=(% scope="col" %)Key|=Field|=NULL | ||
94 | |id|Numeric value, PRIMARY KEY|- | ||
95 | |image|URL|null | ||
96 | |thumb|URL|null | ||
97 | |title|Text|empty string | ||
98 | |description|Text|empty string | ||
99 | |status|L ~| F ~| R (Lost, Found or Returned)|- | ||
100 | |lost_timestamp|ISO date|null | ||
101 | |found_timestamp|ISO date|null | ||
102 | |return_timestamp|ISO date|null | ||
103 | |||
104 | ==== Briefings Database ==== | ||
105 | |||
106 | {{box}} | ||
107 | { | ||
108 | "data": [ | ||
109 | { | ||
110 | "id": "17", | ||
111 | "class": "P", | ||
112 | "topic": "UPDATE - Security News 21.12.2021", | ||
113 | "content": "<div id=\"briefing_content_content\"><div><b>Germany cancelled New Years Eve</b></div><div>Although it might calendar wise be unwise, Germany just cancelled New Years Eve. Further information can be obtained elsewhere.</div><div><br></div><div><b>Some things found</b></div><div>Security\r\n wants to remind all attendees that information about lost or found \r\nitems can be obtained via the APP or the Website of the convention. Lost\r\n & Found is maintained by security and located in the security \r\noffice.</div><div><br></div><div><b>Quote of the day</b></div><div>\"Where is your neighbour?\"</div><div>\"He's in the garden ...\"</div><div>\"I can't see him ...\"</div><div>\"Oh, you'd have to dig quite a bit ...\"<br></div><div><br></div></div>", | ||
114 | "ops_id": "112", | ||
115 | "datetime_creation": "2021-12-21 22:19:45", | ||
116 | "datetime_lastchange": "", | ||
117 | "datetime": "2021-12-21 22:19:45" | ||
118 | } | ||
119 | ] | ||
120 | } | ||
121 | {{/box}} | ||
122 | |||
123 | (% style="width:50%" %) | ||
124 | |=(% colspan="3" %)Briefings fieldset | ||
125 | |=(% scope="col" %)Key|=Field|=NULL | ||
126 | |id|Numeric value, PRIMARY KEY|- | ||
127 | |class|P (hopefully only P)|- | ||
128 | |topic|Text|empty string | ||
129 | |content|HTML|empty string | ||
130 | |ops_id|Numeric value, the L.A.S.S.I.E. ID of the creator|- | ||
131 | |datetime_creation|ISO date|- | ||
132 | |datetime_lastchange|ISO date|null | ||
133 | |datetime|ISO date which should be displayed. Is creation or lastchange whatever is bigger.|- | ||
134 | |||
135 | ==== Empty Object ==== | ||
136 | |||
137 | {{box}} | ||
138 | { | ||
139 | "data": [] | ||
140 | } | ||
141 | {{/box}} | ||
142 | |||
143 | === Error Codes === | ||
144 | |||
145 | The API will send a JSON-Object upon errors | ||
146 | |||
147 | {{box}} | ||
148 | { | ||
149 | "error": { | ||
150 | "code": "503", | ||
151 | "message": "Maintenance Mode enabled - please try again later" | ||
152 | } | ||
153 | } | ||
154 | {{/box}} | ||
155 | |||
156 | The following error codes are implemented: | ||
157 | |||
158 | (% style="width:50%" %) | ||
159 | |=(% colspan="3" %)Error Codes | ||
160 | |=(% scope="col" %)Code|=Message|=Description | ||
161 | |401|Unauthorized|API-Key is not correct or no API-Key provided. | ||
162 | |500|Internal server error|Most likely the mySQL-Connection failed. A certain Dingo might be rather busy at this time. | ||
163 | |501|Bad or no request|Whatever you send, it wasn't a valid request. | ||
164 | |503|Maintenance Mode enabled - please try again later|Might follow an error 500 and the Dingo is still busy ... |