Files
paramdb/README.md

107 lines
1.7 KiB
Markdown
Raw Normal View History

2024-09-26 23:16:12 +02:00
# ParamDB
* 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.
* Unique index on collection+name+validity.
## 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"
}
}
}
```
### 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
{
"keys": {
"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.
```json
POST /businessinfo/delete
Content-Type: application/json
[ 19 ]
```
### 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"
}
}
}
```