Skip to content
Guido Krömer edited this page Jan 25, 2014 · 1 revision

The config API resource is a simple key value store for storing frontend and backend configuration values.

Unlike the other API resources the config API returns an array as a result on each GET request, this is conditional, by the way keys working. Several keys can be grouped by using the same prefix and can fetched together by using the prefix only as key.

GET api/1/config

Get all config values.

Example response

{
  "status": 200,
  "response": [
    {
      "id":    1,
      "key":   "database-version",
      "value": 1
    },
    {
      "id":    2,
      "key":   "update-interval-min",
      "value": 600
    },
    {
      "id":    3,
      "key":   "update-interval-max",
      "value": 604800
    },
  ]
}

POST api/1/config

Create a new config value

Example request

{
  "key":  "example",
  "value": 1337
}

Example response

{
  "status": 201,
  "response": 4 /*Id of newly added config value*/
}

GET api/1/config/:key

Get a set config value by its key

Example request api/1/config/database-version

Example response

{
  "status": 200,
  "response": [
    {
      "id":    1,
      "key":   "database-version",
      "value": 1
    }
  ]
}

PUT api/1/config/:key

Edit a config value specified by its key

Example request api/1/config/update-interval-max

{
  "value": "3600"
}

Example response

{
  "status": 200,
  "response": 3
}

DELETE api/1/config/:key

Delete a config value specified by key

Example request api/1/config/example

Example response

{
  "status": 200,
  "response": 4
}

Clone this wiki locally