forked from woehrl01/seapal-web
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapiary.apib
284 lines (259 loc) · 6.61 KB
/
apiary.apib
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
HOST: http://localhost:9000/
--- Seapal Play ---
--
make sure that you're logged in.
UUIDOfAccount looks like '523b7def-af42-4b3a-8eca-63a583f69ecf'
--
-- General --
If you request a document you don't have access to, you'll receive an empty JSON array. If you're not logged in (Play Session cookie does not exist), you'll receive the following JSON object:
GET /restricted/url
< 401
< Content-Type: application/json
{
"error": "unauthorized"
}
-- Boats --
Get all boats that belong to the currently logged in user.
GET /api/boat
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
[{
"owner": "UUIDOfAccount",
"crew": [],
"boatName": "test4",
"registerNr": "",
"sailSign": "",
"homePort": "",
"yachtclub": "",
"insurance": "",
"callSign": "",
"type": "",
"constructor": "",
"length": 0.0,
"width": 0.0,
"draft": 0.0,
"mastHeight": 0.0,
"displacement": 0.0,
"rigging": "",
"yearOfConstruction": 0,
"motor": "",
"tankSize": 0.0,
"wasteWaterTankSize": 0.0,
"freshWaterTankSize": 0.0,
"mainSailSize": 0.0,
"genuaSize": 0.0,
"spiSize": 0.0,
"_id": "010a0c10-4e6a-437e-87b6-cdcf7056d76f",
"_rev": "2-6f53f9467726b2fa04ad1aedb0249562"
}]
Get a single boat. this is also an array. If the array is empty, the boat either doesn't exist or you don't have access to it.
GET /api/boat/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
[{
"owner": "523b7def-af42-4b3a-8eca-63a583f69ecf",
"crew": [],
"boatName": "test4",
"registerNr": "",
"sailSign": "",
"homePort": "",
"yachtclub": "",
"insurance": "",
"callSign": "",
"type": "",
"constructor": "",
"length": 0.0,
"width": 0.0,
"draft": 0.0,
"mastHeight": 0.0,
"displacement": 0.0,
"rigging": "",
"yearOfConstruction": 0,
"motor": "",
"tankSize": 0.0,
"wasteWaterTankSize": 0.0,
"freshWaterTankSize": 0.0,
"mainSailSize": 0.0,
"genuaSize": 0.0,
"spiSize": 0.0,
"_id": "010a0c10-4e6a-437e-87b6-cdcf7056d76f",
"_rev": "2-6f53f9467726b2fa04ad1aedb0249562"
}]
Add a new boat to the database. The field owner will be set to the id of the currently logged in user.
POST /api/boat
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
[{
"owner": "UUIDOfAccount",
"crew": [],
"boatName": "test4",
"registerNr": "",
"sailSign": "",
"homePort": "",
"yachtclub": "",
"insurance": "",
"callSign": "",
"type": "",
"constructor": "",
"length": 0.0,
"width": 0.0,
"draft": 0.0,
"mastHeight": 0.0,
"displacement": 0.0,
"rigging": "",
"yearOfConstruction": 0,
"motor": "",
"tankSize": 0.0,
"wasteWaterTankSize": 0.0,
"freshWaterTankSize": 0.0,
"mainSailSize": 0.0,
"genuaSize": 0.0,
"spiSize": 0.0,
"_id": "010a0c10-4e6a-437e-87b6-cdcf7056d76f",
"_rev": "2-6f53f9467726b2fa04ad1aedb0249562"
}]
< 201
{
"success": true
}
Delete a boat from the database.
DELETE /api/boat/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
{
"success": true
}
-- Trips --
Get all trips that belong to this boat.
GET /api/boat/$id<[0-9a-fA-F\-]+>/trips
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Get all trips that belong to the currently logged in user.
GET /api/trip
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Get a single trip.
GET /api/trip/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Delete a trip.
DELETE /api/trip/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Create a new trip.
POST /api/trip
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
-- Waypoints --
Get all waypoints of a single trip.
GET /api/trip/$id<[0-9a-fA-F\-]+>/waypoints
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Get a single waypoint.
GET /api/waypoint/$waypointId<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Get all waypoints that belong to the currently logged in user.
POST /api/waypoint
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
-- Routes --
Get all routes that belong to the currently logged in user.
GET /api/route
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Get a single route.
GET /api/route/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Add a new route to the database. The field owner will be set to the id of the currently logged in user.
POST /api/route
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
{
"error": "this isn't the JSON document you're looking for"
}
< 201
{
"success": true
}
Delete a route from the database.
DELETE /api/route/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
{
"success": true
}
-- Marks --
Get all marks that belong to this account.
GET /api/mark/
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Get a single mark.
GET /api/mark/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Delete a mark.
DELETE /api/mark/$id<[0-9a-fA-F\-]+>
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}
Create a new mark.
POST /api/mark
> Cookie: PLAY_SESSION="playInternalHash-id=UUIDOfAccount"
< 200
< Content-Type: application/json
{
"error": "this isn't the JSON document you're looking for"
}