# ParamDB ParamDB is a key-value store that is time-aware. Multiple values can be assigned to each key with unique validity ranges. It can be used to feed static information that varies with time to templates or to serve news. ## Introduction There are situations where you need data to slap into a template, and the data may vary over time. * Sending alert e-mails including contact information for the curent support techs. * Seasonal greetings in automatically generated content. ParamDB solves this problem by serving collections of keys over HTTP. A collection can contain any number of keys, and a key can contain any number of values. ## Features * Values are serialized, so arrays and objects can be stored and restored. * Not intended to be running as a public service, so there is no authentication, for now. * Last value that matches is returned. ### Future * Metadata; store with key "meta" in value set post call, returned under a "meta" key in the result list. ## Using ### Store values ```json POST /businessinfo Content-Type: application/json [ { "openhours": { "value": "Mo-Fr 09-17, Sa-Su 12-02", "valid": { "from": "2024-10-01 00:00:00 +02:00", "until": "2024-10-07 23:59:59 +02:00" } } } ] ``` > [!NOTE] > The only required key is `value`, and as there can only be one value without validity it will overwrite any existing value. ### Retrieve current values ```json GET /businessinfo { "openhours": "Mo-Fr 09-17, Sa-Su 10-01" } ``` Query params: * `date=` - override date (default is now) in the format "Y-m-d H:i:s P" ### Retrieve all values ```json GET /businessinfo/all { "openhours": [ { "id": 13, "value": "Mo-Fr 09-17, Sa-Su 10-01" }, { "id": 19, "value": "Mo-Fr 09-17, Sa-Su 12-02", "valid": { "from": "2024-10-01 00:00:00 +02:00", "until": "2024-10-07 23:59:59 +02:00" } ] } } ``` Query params: * `only=` - comma-separated list of keys to match ### Delete value Delete by posting an array of value IDs and keys to delete. ```json POST /businessinfo/delete Content-Type: application/json [ 19, "some.key" ] ``` ### Update a value Update by including an existing id with the set request. ```json POST /businessinfo Content-Type: application/json { "openhours": { "id": 19, "value": "Mo-Fr 09-17, Sa-Su 12-03", "valid": { "from": "2024-10-01 00:00:00 +02:00", "until": "2024-10-07 23:59:59 +02:00" } } } ``` ### Delete a colleciton Update by including an existing id with the set request. ```json POST /businessinfo/purge ```