Web Services Definition » History » Version 19
Kurt Gerber, 13 Dec 2018 16:00
1 | 10 | Kurt Gerber | h1. API / Web Services Requirements |
---|---|---|---|
2 | 2 | Kurt Gerber | |
3 | h2. Request services |
||
4 | 11 | Kurt Gerber | |
5 | 1 | Kurt Gerber | The existing API is documented here: https://qcat.readthedocs.io/en/latest/api/docs.html |
6 | |||
7 | 12 | Kurt Gerber | h3. Required missing request services: |
8 | 10 | Kurt Gerber | |
9 | 12 | Kurt Gerber | * There is an endpoint to get the configuration for a specific questionnaire and edition: https://https://qcat.wocat.net/en/api/v2/configuration/technologies/2018/ |
10 | 10 | Kurt Gerber | |
11 | 12 | Kurt Gerber | 1. Whithout the 'edition' endpoint, it should response with an array of available editions. Now it answers with a 'Not found' html page. |
12 | 10 | Kurt Gerber | |
13 | 12 | Kurt Gerber | 2. Without the specific configuration endpoint (like 'technologies'), the response should be an array of available configurations. Now it answers with a 'Not found' html page. |
14 | |||
15 | |||
16 | 10 | Kurt Gerber | h2. Requirements for services to add / update cases |
17 | 12 | Kurt Gerber | |
18 | 15 | Kurt Gerber | The following new webservice endpoints must be developed. |
19 | 1 | Kurt Gerber | |
20 | 17 | Kurt Gerber | h3.1. Authentification endpoint |
21 | 12 | Kurt Gerber | |
22 | To upload a case, a user has to authenticate himself. Therefore an authentification endpoint is needed. |
||
23 | 1 | Kurt Gerber | |
24 | 13 | Kurt Gerber | %{background:#F2D5A0} The existing authorization token serves only as authorization to access the API. |
25 | 15 | Kurt Gerber | The token is application based and always the same for a certain application, independently of the user working with the application.% |
26 | 1 | Kurt Gerber | |
27 | 17 | Kurt Gerber | * The user has to authenticate before any data is uploaded or non-public downloaded. |
28 | * After a successfull authentification, the server sends a 'sessionid'. This sessionid has to be added to the request header for any subsequent POST request. Should work a bit as on the web UI with the sessionid in the cookie. |
||
29 | * LImitations on client side? (to discuss) |
||
30 | 1 | Kurt Gerber | |
31 | |||
32 | 17 | Kurt Gerber | *Endpoint:* _/api/v2/user-token/_ |
33 | |||
34 | 1 | Kurt Gerber | *Allowed method:* _POST_ |
35 | |||
36 | 16 | Kurt Gerber | *Post data:* |
37 | 15 | Kurt Gerber | |
38 | 17 | Kurt Gerber | * @username@: The username of a WOCAT account |
39 | * @password@: The password of the corresponding WOCAT account |
||
40 | 15 | Kurt Gerber | |
41 | |||
42 | 17 | Kurt Gerber | *Response:* |
43 | 19 | Kurt Gerber | <pre><code class="json"> |
44 | {"sessionid":"09249249243729342123ad232dc"} |
||
45 | </code></pre> |
||
46 | 1 | Kurt Gerber | |
47 | 15 | Kurt Gerber | |
48 | 1 | Kurt Gerber | |
49 | 19 | Kurt Gerber | |
50 | 17 | Kurt Gerber | h3. 2. Upload endpoint |
51 | 1 | Kurt Gerber | |
52 | |||
53 | 17 | Kurt Gerber | *Endpoint:* @/api/v2/create/<configuration>/<edition>@ |
54 | 1 | Kurt Gerber | |
55 | 17 | Kurt Gerber | *Allowed method:* @POST@ |
56 | 14 | Kurt Gerber | |
57 | 17 | Kurt Gerber | *POST data:* a valid questionnaire based on the corresponding "configuration template":https://qcat.readthedocs.io/en/latest/api/v2.html#structure-of-configuration |
58 | 1 | Kurt Gerber | |
59 | 18 | Kurt Gerber | *Request Header:* |
60 | 17 | Kurt Gerber | * @Authorization: Token AUTH_TOKEN@ |
61 | * @sessionid: 6xn26rwsy0r0k2yn5bsoq2qiyssg9mrs@ |
||
62 | * @Accept: application/json@ or @Accept: application/xml@ |
||
63 | 1 | Kurt Gerber | * @Content-Type: application/json@ or @Content-Type: application/xml@ |
64 | 19 | Kurt Gerber | |
65 | |||
66 | *Response:* |
||
67 | <pre><code class="json"> |
||
68 | {"success":"true", |
||
69 | "code": "technologies_4534" |
||
70 | } |
||
71 | |||
72 | </code></pre> |