summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexia Pagkopoulou <a.pagkopoulou@tum.de>2019-08-20 11:23:21 +0200
committerAlexia Pagkopoulou <a.pagkopoulou@tum.de>2019-08-20 11:23:21 +0200
commit2b56d58578770ff643fd32716c0dd336e50ccfcf (patch)
tree99e00570a35032998c962e80af2e806bc2c8324c
parentc4883a8df28fef1021b77f42348d601dddbc82ca (diff)
downloadgnunet-rest-api-2b56d58578770ff643fd32716c0dd336e50ccfcf.tar.gz
gnunet-rest-api-2b56d58578770ff643fd32716c0dd336e50ccfcf.zip
added config API docHEADdevelop
-rw-r--r--source/config.rst124
-rw-r--r--source/index.rst1
2 files changed, 125 insertions, 0 deletions
diff --git a/source/config.rst b/source/config.rst
new file mode 100644
index 0000000..e5e6dc9
--- /dev/null
+++ b/source/config.rst
@@ -0,0 +1,124 @@
1Config API Service
2==================
3
4Definition
5~~~~~~~~~~
6
7Variables in single quotes ``'...'`` can or must be changed according to your specific case.
8
9``config`` refers to the configuration file.
10
11``'section'`` is a section of settings in the configuration file.
12
13``'option'`` is an setting in the configuration file with a modifiable ``'value'``.
14
15Configuration
16-------------
17
18The configuration file is divided in ``sections``, each consisting of various ``options`` with their corresponding ``values``.
19
20Error Response
21--------------
22
23An error response is sent in the JSON format: ``{"error":"*error_description*"}``
24
25Following numbers are added for references inside the documentation only.
26
27Error descriptions are::
28
29 Nr. Error Description - Explanation
30 1) Unknown Error - Error is not specified
31 2) Unable to parse JSON Object from "*URI*" - Corrupt JSON data given
32
33Error ``1)`` is always possible and is not listed in following requests.
34
35ATTENTION: Any error message from the Configuration API (not REST API) can occur and can be returned in the error response. These responses are not listed here.
36
37Response Code
38-------------
39
40A response of a message has a HTTP response code. Usually, this code is 200 OK for a successful response. The code changes in some cases::
41
42 a) 200 OK - Normal response (but may contain an error message)
43 b) 201 Created - Success after POST request
44 c) 400 Bad Request - Invalid request
45
46Requests
47~~~~~~~~
48
49GET Requests
50------------
51
52+--------------------+---------------------------------------------------------------+
53|**Title** | Returns the config or the specified section of the config |
54+--------------------+---------------------------------------------------------------+
55|**URL** | :literal:`/config` |
56+--------------------+---------------------------------------------------------------+
57|**Method** | **GET** |
58+--------------------+---------------------------------------------------------------+
59|**URL Params** | none |
60+--------------------+---------------------------------------------------------------+
61|**Data Params** | none |
62+--------------------+---------------------------------------------------------------+
63|**Success Response**| {"section":{"option":"*value*",...},...} |
64+--------------------+---------------------------------------------------------------+
65|**Error Response** | {"error":"*error_desc*"} |
66+--------------------+---------------------------------------------------------------+
67
68|
69
70+--------------------+---------------------------------------------------------------+
71|**Title** | Returns only a specific section |
72+--------------------+---------------------------------------------------------------+
73|**URL** | ``/config/'section'`` |
74+--------------------+---------------------------------------------------------------+
75|**Method** | **GET** |
76+--------------------+---------------------------------------------------------------+
77|**URL Params** | none |
78+--------------------+---------------------------------------------------------------+
79|**Data Params** | none |
80+--------------------+---------------------------------------------------------------+
81|**Success Response**| {"option":"*value*",...} |
82+--------------------+---------------------------------------------------------------+
83|**Error Response** | {"error":"*error_desc*"} |
84+--------------------+---------------------------------------------------------------+
85
86
87POST Request
88------------
89
90+--------------------+---------------------------------------------------------------+
91|**Title** | Creates/modifies options in the config |
92+--------------------+---------------------------------------------------------------+
93|**URL** | :literal:`/config` |
94+--------------------+---------------------------------------------------------------+
95|**Method** | **POST** |
96+--------------------+---------------------------------------------------------------+
97|**URL Params** | none |
98+--------------------+---------------------------------------------------------------+
99|**Data Params** | {"'section'": {"'option'": "'value'",...},...} |
100+--------------------+---------------------------------------------------------------+
101|**Success Response**| Response Code: ``b) 200 OK`` |
102+--------------------+---------------------------------------------------------------+
103|**Error Response** | | {"error":"*error_desc*"} |
104+--------------------+---------------------------------------------------------------+
105
106
107OPTIONS Request
108---------------
109
110+--------------------+---------------------------------------------------------------+
111|**Title** | Gets request options |
112+--------------------+---------------------------------------------------------------+
113|**URL** | :literal:`/config` |
114+--------------------+---------------------------------------------------------------+
115|**Method** | **OPTIONS** |
116+--------------------+---------------------------------------------------------------+
117|**URL Params** | none |
118+--------------------+---------------------------------------------------------------+
119|**Data Params** | none |
120+--------------------+---------------------------------------------------------------+
121|**Success Response**| |
122+--------------------+---------------------------------------------------------------+
123|**Error Response** | none |
124+--------------------+---------------------------------------------------------------+
diff --git a/source/index.rst b/source/index.rst
index 4fc373e..f68257c 100644
--- a/source/index.rst
+++ b/source/index.rst
@@ -37,6 +37,7 @@ Services
37 namestore 37 namestore
38 gns 38 gns
39 peerinfo 39 peerinfo
40 config
40 41
41 42
42 43