API » History » Version 6
Denis Kildishev, 04/22/2020 08:15 PM
1 | 1 | Denis Kildishev | h1. API |
---|---|---|---|
2 | |||
3 | 5 | Denis Kildishev | All api method calls are needs to have such header |
4 | Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 |
||
5 | 6 | Denis Kildishev | Security code can be changed by passing -apikey={newkey} line to .ini file |
6 | Api handles only local requests by default. To listen a global requests you need to add -globalapi line to .ini file |
||
7 | 5 | Denis Kildishev | |
8 | 1 | Denis Kildishev | h2. Experimental |
9 | |||
10 | h3. Test data |
||
11 | |||
12 | ed612ae4-ced3-408c-8d64-66d87981611f — id of document |
||
13 | 5b9946fe-585c-47f6-93bb-5bb2e37a04d3 — id of new location |
||
14 | b7088d84-9c96-4657-abab-7690585ddd8e — id of requirement |
||
15 | |||
16 | h3. Methods |
||
17 | 2 | Denis Kildishev | |
18 | 5 | Denis Kildishev | *Description*: |
19 | get document and all locs |
||
20 | *Method*: |
||
21 | 2 | Denis Kildishev | GET |
22 | 5 | Denis Kildishev | *Path*: |
23 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f |
24 | |||
25 | 5 | Denis Kildishev | *Description*: |
26 | add location to doc with id before addloc |
||
27 | *Method*: |
||
28 | 1 | Denis Kildishev | PUT |
29 | 5 | Denis Kildishev | *Path*: |
30 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/addlocation |
31 | |||
32 | 5 | Denis Kildishev | *Description*: |
33 | list all locations |
||
34 | *Method*: |
||
35 | 1 | Denis Kildishev | GET |
36 | 5 | Denis Kildishev | *Path*: |
37 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/locations |
38 | |||
39 | 5 | Denis Kildishev | *Description*: |
40 | 1 | Denis Kildishev | get contents of document and all related resourses in form of multidata |
41 | have fields |
||
42 | *fileName* — name of xhtml file |
||
43 | *resources* — list of related resources |
||
44 | for example, "imgs/testDoc_html_2f94255ac1355d0d.jpg", "testDoc.xhtml", "imgs/testDoc_html_6a3c8113b28c3ae7.jpg" |
||
45 | and several files. File with html content have name «html» |
||
46 | 5 | Denis Kildishev | *Method*: |
47 | GET |
||
48 | *Path*: |
||
49 | http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/fulldata |
||
50 | 1 | Denis Kildishev | |
51 | 5 | Denis Kildishev | *Description*: |
52 | Get contents of xhtml content of document |
||
53 | *Method*: |
||
54 | GET |
||
55 | *Path*: |
||
56 | http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/contents |
||
57 | |||
58 | *Description*: |
||
59 | Get contents of xhtml content of document |
||
60 | *Method*: |
||
61 | GET |
||
62 | *Path*: |
||
63 | http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/contents/{subpath} |
||
64 | where subpath is possible path to related resources like /images/1.jpg |
||
65 | *Description*: |
||
66 | removes location |
||
67 | *Method*: |
||
68 | 1 | Denis Kildishev | DELETE |
69 | 5 | Denis Kildishev | *Path*: |
70 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3 |
71 | 4 | Denis Kildishev | |
72 | 5 | Denis Kildishev | *Description*: |
73 | get location |
||
74 | *Method*: |
||
75 | 4 | Denis Kildishev | GET |
76 | 5 | Denis Kildishev | *Path*: |
77 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3 |
78 | |||
79 | 5 | Denis Kildishev | *Description*: |
80 | adds fragment to location |
||
81 | *Method*: |
||
82 | 4 | Denis Kildishev | POST |
83 | 5 | Denis Kildishev | *Path*: |
84 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/addfragment |
85 | 5 | Denis Kildishev | *Body*: |
86 | 4 | Denis Kildishev | { |
87 | 5 | Denis Kildishev | „start“:“0“, |
88 | „end“:“20“ |
||
89 | 1 | Denis Kildishev | } |
90 | 4 | Denis Kildishev | |
91 | 5 | Denis Kildishev | *Description*: |
92 | removes fragment from location |
||
93 | *Method*: |
||
94 | 1 | Denis Kildishev | POST |
95 | 5 | Denis Kildishev | *Path*: |
96 | 4 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/removefragment |
97 | 5 | Denis Kildishev | *Body*: |
98 | 4 | Denis Kildishev | { |
99 | 1 | Denis Kildishev | „start“:“0“, |
100 | „end“:“20“ |
||
101 | } |
||
102 | 4 | Denis Kildishev | |
103 | 5 | Denis Kildishev | *Description*: |
104 | add link between requirement and location |
||
105 | *Method*: |
||
106 | 1 | Denis Kildishev | POST |
107 | 5 | Denis Kildishev | *Path*: |
108 | 4 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/linkto/b7088d84-9c96-4657-abab-7690585ddd8e |
109 | 1 | Denis Kildishev | |
110 | 5 | Denis Kildishev | *Description*: |
111 | remove link between requirement and location |
||
112 | *Method*: |
||
113 | 1 | Denis Kildishev | DELETE |
114 | 5 | Denis Kildishev | *Path*: |
115 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/linkto/b7088d84-9c96-4657-abab-7690585ddd8e |
116 | |||
117 | 5 | Denis Kildishev | *Description*: |
118 | list all resources for node |
||
119 | *Method*: |
||
120 | 1 | Denis Kildishev | GET |
121 | 5 | Denis Kildishev | *Path*: |
122 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f |
123 | |||
124 | 5 | Denis Kildishev | *Description*: |
125 | returns content of resource with given subpath |
||
126 | *Method*: |
||
127 | 1 | Denis Kildishev | GET |
128 | 5 | Denis Kildishev | *Paths*: |
129 | 1 | Denis Kildishev | http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f/subpath.xhtml |
130 | or |
||
131 | 4 | Denis Kildishev | http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f/images/1.jpg |
132 | |||
133 | 5 | Denis Kildishev | h2. Common api description |
134 | 1 | Denis Kildishev | |
135 | 5 | Denis Kildishev | *Description*: |
136 | Create project |
||
137 | *Method *: |
||
138 | PUT |
||
139 | *Path*: |
||
140 | http://localhost:9988/projects/{project_name} |
||
141 | 4 | Denis Kildishev | |
142 | 5 | Denis Kildishev | *Description*: |
143 | Delete project |
||
144 | *Method*: |
||
145 | DELETE |
||
146 | *Path*: |
||
147 | http://localhost:9988/projects/{project_name} |
||
148 | 1 | Denis Kildishev | |
149 | 5 | Denis Kildishev | *Description*: |
150 | List project and all its containment nodes and its attributes |
||
151 | *Method*: |
||
152 | GET |
||
153 | *Path*: |
||
154 | http://localhost:9988/projects/{project_name} |
||
155 | 1 | Denis Kildishev | |
156 | 5 | Denis Kildishev | *Description*: |
157 | List all enum definitions(user-defined attr types) |
||
158 | *Method*: |
||
159 | GET |
||
160 | *Path*: |
||
161 | http://localhost:9988/projects/{project_name}/enumDefs |
||
162 | 1 | Denis Kildishev | |
163 | 5 | Denis Kildishev | *Description*: |
164 | Add enum definition |
||
165 | *Method*: |
||
166 | PUT |
||
167 | *Path*: |
||
168 | http://localhost:9988/projects/{project_name}/enumDefs |
||
169 | *Body*: |
||
170 | 4 | Denis Kildishev | { |
171 | "attributes":{ |
||
172 | "3": { |
||
173 | "value": [ |
||
174 | { |
||
175 | "value": "1" |
||
176 | }, |
||
177 | { |
||
178 | "value": "2" |
||
179 | }, |
||
180 | { |
||
181 | "comment"[optional]: "test", |
||
182 | "value": "3" |
||
183 | } |
||
184 | ], |
||
185 | 1 | Denis Kildishev | "valuesType"[optional, STRING by def]: "STRING", |
186 | "type": "ENUM_DEFINITION" |
||
187 | } |
||
188 | } |
||
189 | } |
||
190 | |||
191 | 5 | Denis Kildishev | *Description*: |
192 | force new enum definitions |
||
193 | *Method*: |
||
194 | POST |
||
195 | *Path*: |
||
196 | http://localhost:9988/projects/{project_name}/enumDefs |
||
197 | Body is the same as for prev. |
||
198 | 1 | Denis Kildishev | |
199 | 5 | Denis Kildishev | *Description*: |
200 | Get node and all its attributes |
||
201 | *Method*: |
||
202 | POST |
||
203 | *Path*: |
||
204 | http://localhost:9988/projects/{project_name}/node |
||
205 | *Body*: |
||
206 | Path to node - qualified id, UserVisible Id or UUID |
||
207 | 1 | Denis Kildishev | |
208 | 5 | Denis Kildishev | *Description*: |
209 | Get node and all its successors(subtree) |
||
210 | *Method*: |
||
211 | POST |
||
212 | *Path*: |
||
213 | http://localhost:9988/projects/{project_name}/tree |
||
214 | *Body*: |
||
215 | Path to node - qualified id, UserVisible Id or UUID |
||
216 | 1 | Denis Kildishev | |
217 | 5 | Denis Kildishev | *Description*: |
218 | Get requirements subtree with all attributes |
||
219 | *Method*: |
||
220 | GET |
||
221 | *Path*: |
||
222 | http://localhost:9988/projects/{project_name}/tree |
||
223 | 4 | Denis Kildishev | |
224 | 5 | Denis Kildishev | *Description*: |
225 | Get subtree up to {lvl} depth |
||
226 | *Method*: |
||
227 | POST |
||
228 | *Path*: |
||
229 | http://localhost:9988/projects/{project_name}/tree-{lvl} |
||
230 | *Body*: |
||
231 | Path to node - qualified id, UserVisible Id or UUID |
||
232 | 4 | Denis Kildishev | |
233 | 5 | Denis Kildishev | *Description*: |
234 | Set attributes |
||
235 | *Method*: |
||
236 | PUT |
||
237 | *Path*: |
||
238 | http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/attributes/ |
||
239 | *Datatype*: |
||
240 | multipart/form-data |
||
241 | *Body*: |
||
242 | two type of fields - input contains json, images contains images |
||
243 | input example = |
||
244 | 4 | Denis Kildishev | { |
245 | "attributes": { |
||
246 | "test": { |
||
247 | "value": "13d23", |
||
248 | "type": "INT" |
||
249 | }, |
||
250 | 1 | Denis Kildishev | "_name": { |
251 | 4 | Denis Kildishev | "value": "{test} test 123" |
252 | }, |
||
253 | 1 | Denis Kildishev | "Ref": { |
254 | 4 | Denis Kildishev | "type": "REFERENCE", |
255 | "value":"test" |
||
256 | } |
||
257 | "2": { |
||
258 | "value": [ |
||
259 | { |
||
260 | "value": "001 2/001" |
||
261 | }, |
||
262 | { |
||
263 | "value": "002/001/001" |
||
264 | }, |
||
265 | { |
||
266 | "value": "Requirements" |
||
267 | } |
||
268 | ], |
||
269 | "valuesType": "REFERENCE", |
||
270 | "type": "LIST" |
||
271 | }, |
||
272 | "3val": { |
||
273 | "value": "1", |
||
274 | "enumName": "3", |
||
275 | "type": "ENUM" |
||
276 | 1 | Denis Kildishev | } |
277 | 4 | Denis Kildishev | } |
278 | |||
279 | 5 | Denis Kildishev | *Description*: |
280 | Delete attributes |
||
281 | *Method*: |
||
282 | DELETE |
||
283 | *Path*: |
||
284 | http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/attributes/ |
||
285 | *Body*: |
||
286 | {name1}, {name2}... |
||
287 | *Returns*: |
||
288 | Current set of attributes |
||
289 | 4 | Denis Kildishev | |
290 | 5 | Denis Kildishev | *Description*: |
291 | Delete node |
||
292 | *Method*: |
||
293 | DELETE |
||
294 | *Path*: |
||
295 | http://localhost:9988/projects/{project_name}/node |
||
296 | *Body*: |
||
297 | Path to node - qualified id, UserVisible Id or UUID |
||
298 | *Returns*: |
||
299 | New subtree from parent of deleted node |
||
300 | 4 | Denis Kildishev | |
301 | 5 | Denis Kildishev | *Description*: |
302 | Move node without autorename, if node with new name exists then returns error |
||
303 | *Method*: |
||
304 | POST |
||
305 | *Path*: |
||
306 | http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/move |
||
307 | *Body*: |
||
308 | Path to node - qualified id, UserVisible Id or UUID |
||
309 | *Returns*: |
||
310 | New subtree from parent of moved node |
||
311 | 4 | Denis Kildishev | |
312 | 5 | Denis Kildishev | *Description*: |
313 | Move node withautorename |
||
314 | *Method*: |
||
315 | POST |
||
316 | *Path*: |
||
317 | http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/move-rename |
||
318 | *Body*: |
||
319 | Path to node - qualified id, UserVisible Id or UUID |
||
320 | *Returns*: |
||
321 | New subtree from parent of moved node |
||
322 | 4 | Denis Kildishev | |
323 | 5 | Denis Kildishev | *Description*: |
324 | Move node after given one with autorename |
||
325 | *Method*: |
||
326 | POST |
||
327 | *Path*: |
||
328 | http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/move-after |
||
329 | *Body*: |
||
330 | Path to node after which target node needs to be moved - qualified id, UserVisible Id or UUID |
||
331 | New subtree from parent of moved node |
||
332 | 4 | Denis Kildishev | |
333 | 5 | Denis Kildishev | *Description*: |
334 | Get identifier |
||
335 | *Method*: |
||
336 | GET |
||
337 | *Path*: |
||
338 | http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/id |
||
339 | *Returns*: |
||
340 | Id, qualifiedId and user-visible id |
||
341 | 4 | Denis Kildishev | |
342 | 5 | Denis Kildishev | *Description*: |
343 | Rename a node |
||
344 | *Method*: |
||
345 | PUT |
||
346 | *Path*: |
||
347 | http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/id |
||
348 | *Body*: |
||
349 | New id of node |
||
350 | *Returns*: |
||
351 | new id, qualifiedId and user-visible id of node |
||
352 | 4 | Denis Kildishev | |
353 | 5 | Denis Kildishev | *Description*: |
354 | Create a node |
||
355 | *Method*: |
||
356 | PUT |
||
357 | *Path*: |
||
358 | http://localhost:9988/projects/{project_name}/create |
||
359 | *Datatype*: |
||
360 | multipart/form-data |
||
361 | *Body*: |
||
362 | two kinds of fields - input contains json, images contains images |
||
363 | input example = |
||
364 | 4 | Denis Kildishev | { |
365 | "parent": "516bbbbc-babf-45d6-a146-61db334411be", |
||
366 | "type":"Requirement", |
||
367 | "id":"002", |
||
368 | "attributes":{ |
||
369 | "test": { |
||
370 | "value": "13d23", |
||
371 | "type": "INT" |
||
372 | }, |
||
373 | "_name": { |
||
374 | "value": "{test} test 123" |
||
375 | 1 | Denis Kildishev | }, |
376 | "Ref": { |
||
377 | "type": "REFERENCE", |
||
378 | "value":"test" |
||
379 | }, |
||
380 | "_description": { |
||
381 | "value":"test desc <img src='strange.png' alt='strange.xcf'/>", "type":"HTML" |
||
382 | } |
||
383 | } |
||
384 | } |
||
385 | 5 | Denis Kildishev | "id" identifier is optional |
386 | *Example of output*: |
||
387 | List of references |
||
388 | 1 | Denis Kildishev | 2: { |
389 | "valuesType": "REFERENCE", |
||
390 | "value": [ |
||
391 | { |
||
392 | "nodes": [ |
||
393 | "71f2c6d9-aa54-4293-95d4-ed0d50fba6c1" |
||
394 | ], |
||
395 | "value": "001 2/001" |
||
396 | }, |
||
397 | { |
||
398 | "value": "*Missing: '002/001/001'" |
||
399 | }, |
||
400 | { |
||
401 | "nodes": [ |
||
402 | "516bbbbc-babf-45d6-a146-61db334411be" |
||
403 | ], |
||
404 | "value": "Requirements" |
||
405 | } |
||
406 | ], |
||
407 | "type": "LIST" |
||
408 | }, |
||
409 | 5 | Denis Kildishev | Link with error |
410 | 1 | Denis Kildishev | 1: { |
411 | "value": "*Missing: '002/001/001'", |
||
412 | "type": "REFERENCE" |
||
413 | }, |
||
414 | 5 | Denis Kildishev | enum def(GET http://localhost:9988/projects/{project_name}/enumDefs) |
415 | 1 | Denis Kildishev | { |
416 | "success": true, |
||
417 | "result": { |
||
418 | "attributes": { |
||
419 | 3: { |
||
420 | "value": [ |
||
421 | { |
||
422 | "comment": null, |
||
423 | "value": "1" |
||
424 | }, |
||
425 | { |
||
426 | "comment": null, |
||
427 | "value": "2" |
||
428 | }, |
||
429 | { |
||
430 | "comment": null, |
||
431 | "value": "3" |
||
432 | } |
||
433 | ], |
||
434 | "valuesType": "INT", |
||
435 | "type": "ENUM_DEFINITION" |
||
436 | } |
||
437 | } |
||
438 | } |
||
439 | } |
||
440 | 5 | Denis Kildishev | Enum value needs to be contained in enum def with name enumName |
441 | 1 | Denis Kildishev | "3Value": { |
442 | "type": "ENUM", |
||
443 | "enumName": "3", |
||
444 | "value": "1" |
||
445 | }, |