Project

General

Profile

Web Services Definition » History » Version 17

Kurt Gerber, 13 Dec 2018 15:41

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
* @ {"sessionid":"09249249243729342123ad232dc"}@
44 1 Kurt Gerber
45 15 Kurt Gerber
46 1 Kurt Gerber
47 17 Kurt Gerber
h3. 2. Upload endpoint
48 1 Kurt Gerber
49
50 17 Kurt Gerber
*Endpoint:*  @/api/v2/create/<configuration>/<edition>@
51 1 Kurt Gerber
52 17 Kurt Gerber
*Allowed method:*  @POST@
53 14 Kurt Gerber
54 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
55 1 Kurt Gerber
56 17 Kurt Gerber
*Request Header:  
57
* @Authorization: Token AUTH_TOKEN@
58
*  @sessionid: 6xn26rwsy0r0k2yn5bsoq2qiyssg9mrs@
59
*  @Accept: application/json@ or @Accept: application/xml@
60
*  @Content-Type: application/json@ or @Content-Type: application/xml@