diff options
-rw-r--r-- | source/config.rst | 124 | ||||
-rw-r--r-- | source/index.rst | 1 |
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 @@ | |||
1 | Config API Service | ||
2 | ================== | ||
3 | |||
4 | Definition | ||
5 | ~~~~~~~~~~ | ||
6 | |||
7 | Variables 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 | |||
15 | Configuration | ||
16 | ------------- | ||
17 | |||
18 | The configuration file is divided in ``sections``, each consisting of various ``options`` with their corresponding ``values``. | ||
19 | |||
20 | Error Response | ||
21 | -------------- | ||
22 | |||
23 | An error response is sent in the JSON format: ``{"error":"*error_description*"}`` | ||
24 | |||
25 | Following numbers are added for references inside the documentation only. | ||
26 | |||
27 | Error 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 | |||
33 | Error ``1)`` is always possible and is not listed in following requests. | ||
34 | |||
35 | ATTENTION: 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 | |||
37 | Response Code | ||
38 | ------------- | ||
39 | |||
40 | A 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 | |||
46 | Requests | ||
47 | ~~~~~~~~ | ||
48 | |||
49 | GET 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 | |||
87 | POST 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 | |||
107 | OPTIONS 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 | ||