Wiki source code of API V2.0
Last modified by Treyfane Dingo on 2024/03/10 02:07
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 | |(% colspan="1" rowspan="2" %)assets|checkout|Checks out an item described by data array | ||
24 | |checkin|Checks in an item described by data array | ||
25 | |(% colspan="1" rowspan="2" %)attendee|lockerservice|Returns Attendee Information described by data for the LockerService | ||
26 | |onfl|Returns Attendee Information described by data for the OverNight Fursuit Locker | ||
27 | |||
28 | 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. | ||
29 | |||
30 | === Example (CURL) === | ||
31 | |||
32 | {{{curl -X POST -d "apikey=ae629a834729fd3aac6d1f827b1793b0" -d "request=lostandfounddb" https://api.lassie.online/v2.0}}} | ||
33 | |||
34 | This example will display the entire Lost & Found Database of FTC. | ||
35 | |||
36 | {{{curl -X POST -d "apikey=ae629a834729fd3aac6d1f827b1793b0" -d "request=lostandfounddb" -d "command=lost" https://api.lassie.online/v2.0}}} | ||
37 | |||
38 | This example will display only the lost items of the Lost & Found Database of FTC. | ||
39 | |||
40 | === Test API Keys === | ||
41 | |||
42 | The API Keys for FurtherTestCon (FTC) are: | ||
43 | |||
44 | {{{ae629a834729fd3aac6d1f827b1793b2 Attendee Database | ||
45 | ae629a834729fd3aac6d1f827b1793b1 Operatives Database | ||
46 | ae629a834729fd3aac6d1f827b1793b0 Lost & Found Database | ||
47 | ae629a834729fd3aac6d1f827b1793b3 Briefings Database | ||
48 | ae629a834729fd3aac6d1f827b1793b4 Personal Assets Database}}} | ||
49 | |||
50 | === Output === | ||
51 | |||
52 | The output of an valid request to the API will be a JSON-Object like the following examples: | ||
53 | |||
54 | ==== Lost & Found Database ==== | ||
55 | |||
56 | {{box}} | ||
57 | { | ||
58 | "data": [ | ||
59 | { | ||
60 | "id": 1925, | ||
61 | "image": null, | ||
62 | "thumb": null, | ||
63 | "title": "Image", | ||
64 | "description": "invisible, watercolour, found in Schroedinger's box", | ||
65 | "status": "F", | ||
66 | "lost_timestamp": null, | ||
67 | "found_timestamp": "2023-11-24 00:27:24", | ||
68 | "return_timestamp": null | ||
69 | }, | ||
70 | { | ||
71 | "id": 1921, | ||
72 | "image": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/fe3c6670a33d8f4199ffa95a5c23b622.png", | ||
73 | "thumb": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/thumbnail/fe3c6670a33d8f4199ffa95a5c23b622.png", | ||
74 | "title": "Sense of Taste", | ||
75 | "description": "lost in Hotel Restaurant", | ||
76 | "status": "L", | ||
77 | "lost_timestamp": "2023-11-01 16:13:02", | ||
78 | "found_timestamp": null, | ||
79 | "return_timestamp": null | ||
80 | }, | ||
81 | { | ||
82 | "id": 1920, | ||
83 | "image": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/bc7c343fb3807d4d41b7e04fa909aad5.png", | ||
84 | "thumb": "https:~/~/api.lassie.furcom.org/images/lostandfound_db/thumbnail/bc7c343fb3807d4d41b7e04fa909aad5.png", | ||
85 | "title": "Vape", | ||
86 | "description": "black / rainbow, \"GEEKVAPE\", found at Open Stage", | ||
87 | "status": "F", | ||
88 | "lost_timestamp": null, | ||
89 | "found_timestamp": "2023-09-30 23:52:38", | ||
90 | "return_timestamp": null | ||
91 | } | ||
92 | ] | ||
93 | } | ||
94 | {{/box}} | ||
95 | |||
96 | (% style="width:50%" %) | ||
97 | |=(% colspan="3" %)Lost & Found fieldset | ||
98 | |=(% scope="col" %)Key|=Field|=NULL | ||
99 | |id|Numeric value, PRIMARY KEY|- | ||
100 | |image|URL|null | ||
101 | |thumb|URL|null | ||
102 | |title|Text|empty string | ||
103 | |description|Text|empty string | ||
104 | |status|L ~| F ~| R (Lost, Found or Returned)|- | ||
105 | |lost_timestamp|ISO date|null | ||
106 | |found_timestamp|ISO date|null | ||
107 | |return_timestamp|ISO date|null | ||
108 | |||
109 | ==== Briefings Database ==== | ||
110 | |||
111 | {{box}} | ||
112 | { | ||
113 | "data": [ | ||
114 | { | ||
115 | "id": "17", | ||
116 | "class": "P", | ||
117 | "topic": "UPDATE - Security News 21.12.2021", | ||
118 | "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>", | ||
119 | "ops_id": "112", | ||
120 | "datetime_creation": "2021-12-21 22:19:45", | ||
121 | "datetime_lastchange": "", | ||
122 | "datetime": "2021-12-21 22:19:45" | ||
123 | } | ||
124 | ] | ||
125 | } | ||
126 | {{/box}} | ||
127 | |||
128 | (% style="width:50%" %) | ||
129 | |=(% colspan="3" %)Briefings fieldset | ||
130 | |=(% scope="col" %)Key|=Field|=NULL | ||
131 | |id|Numeric value, PRIMARY KEY|- | ||
132 | |class|P (hopefully only P)|- | ||
133 | |topic|Text|empty string | ||
134 | |content|HTML|empty string | ||
135 | |ops_id|Numeric value, the L.A.S.S.I.E. ID of the creator|- | ||
136 | |datetime_creation|ISO date|- | ||
137 | |datetime_lastchange|ISO date|null | ||
138 | |datetime|ISO date which should be displayed. Is creation or lastchange whatever is bigger.|- | ||
139 | |||
140 | ==== (% id="cke_bm_27662S" style="display:none" %) (%%)Personal Assets Database ==== | ||
141 | |||
142 | When giving a command to the Personal Assets Database, a data array has to be POSTed along with the request and command. | ||
143 | |||
144 | (% style="width:955px" %) | ||
145 | |(% colspan="3" style="width:182px" %)**Data Array** | ||
146 | |(% style="width:182px" %)**Key**|(% colspan="2" rowspan="1" style="width:652px" %)**Field Content** | ||
147 | |(% style="width:182px" %)ops_id|(% colspan="2" rowspan="1" style="width:652px" %)Numeric Value, Collar ID of the Operative | ||
148 | |(% style="width:182px" %)attendee|(% colspan="2" rowspan="1" style="width:652px" %)Numeric Value, Attendee Badge ID | ||
149 | |(% style="width:182px" %)type|(% colspan="2" rowspan="1" style="width:652px" %)Numeric Value, the id of the Personal Asset type | ||
150 | |(% style="width:182px" %)serial|(% colspan="2" rowspan="1" style="width:652px" %)Text, the Serial Number of the Personal Asset | ||
151 | |||
152 | {{box}} | ||
153 | { | ||
154 | "data":{ | ||
155 | "command":"checkin", | ||
156 | "id":1715, | ||
157 | "attendee":12, | ||
158 | "type":"Donation Bag", | ||
159 | "serial":"123456789", | ||
160 | "out":"10.03.2024 02:51", | ||
161 | "out_by":112, | ||
162 | "in":"10.03.2024 02:51", | ||
163 | "in_by":112 | ||
164 | } | ||
165 | } | ||
166 | {{/box}} | ||
167 | |||
168 | (% style="width:50%" %) | ||
169 | |=(% colspan="3" %)Personal Assets fieldset | ||
170 | |=(% scope="col" %)Key|=Field|=NULL | ||
171 | |command|Text, the originally issued command|- | ||
172 | |id|Numeric Value, PRIMARY KEY|- | ||
173 | |attendee|Numeric Value|- | ||
174 | |type|Text|- | ||
175 | |serial|Text|- | ||
176 | |out|DE date|- | ||
177 | |out_by|Numeric Value|- | ||
178 | |in|DE date|NULL | ||
179 | |in_by|Numeric Value|NULL | ||
180 | |||
181 | ==== (% id="cke_bm_301917S" style="display:none" %) (%%)Attendee Database ==== | ||
182 | |||
183 | When giving a command to the Personal Assets Database, a data payload has to be POSTed along with the request and command. | ||
184 | |||
185 | (% style="width:955px" %) | ||
186 | |(% style="width:182px" %)**Key**|(% colspan="2" rowspan="1" style="width:652px" %)**Field Content** | ||
187 | |(% style="width:182px" %)data|(% colspan="2" rowspan="1" style="width:652px" %)Numeric Value, Attendee Badge ID | ||
188 | |||
189 | {{box}} | ||
190 | { | ||
191 | "data": { | ||
192 | "id": 1, | ||
193 | "nick": "GLaDOS", | ||
194 | "firstname": "Genetic Lifeform", | ||
195 | "lastname": "and Disk Operating System", | ||
196 | "checkletter": "A" | ||
197 | } | ||
198 | } | ||
199 | {{/box}} | ||
200 | |||
201 | (% style="width:50%" %) | ||
202 | |=(% colspan="3" %)Attendee fieldset | ||
203 | |=(% scope="col" %)Key|=Field|=NULL | ||
204 | |id|Numeric Value, PRIMARY KEY|- | ||
205 | |firstname|Text|- | ||
206 | |lastname|Text|- | ||
207 | |checkletter|Text|NULL | ||
208 | |||
209 | ==== Empty Object ==== | ||
210 | |||
211 | {{box}} | ||
212 | { | ||
213 | "data": [] | ||
214 | } | ||
215 | {{/box}} | ||
216 | |||
217 | === Error Codes === | ||
218 | |||
219 | The API will send a JSON-Object upon errors | ||
220 | |||
221 | {{box}} | ||
222 | { | ||
223 | "error": { | ||
224 | "code": "503", | ||
225 | "message": "Maintenance Mode enabled - please try again later" | ||
226 | } | ||
227 | } | ||
228 | {{/box}} | ||
229 | |||
230 | The following error codes are implemented: | ||
231 | |||
232 | (% style="width:50%" %) | ||
233 | |=(% colspan="3" %)Error Codes | ||
234 | |=(% scope="col" %)Code|=Message|=Description | ||
235 | |401|Unauthorized|API-Key is not correct or no API-Key provided. | ||
236 | |422|Unprocessable Data|The data payload can not be processed due to an error | ||
237 | |500|Internal server error|Most likely the mySQL-Connection failed. A certain Dingo might be rather busy at this time. | ||
238 | |501|Bad or no request|Whatever you send, it wasn't a valid request. | ||
239 | |503|Maintenance Mode enabled - please try again later|Might follow an error 500 and the Dingo is still busy ... |