gnunet-handbook

The GNUnet Handbook
Log | Files | Refs

config.rst (6840B)


      1 Config
      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 +--------------------+---------------------------------------------------------------+