588dba2730b92aa907b46335f5a25e72aed2da3c
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
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"
}
}
}
]
Retrieve current values
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
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 IDs to delete.
POST /businessinfo/delete
Content-Type: application/json
[ 19 ]
Update a value
Update by including an existing id with the set request.
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"
}
}
}
Languages
PHP
96.8%
Makefile
1.9%
Dockerfile
1.3%