aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-reference.md
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-10-13 11:55:20 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-10-13 11:55:20 +0200
commite66534eefb5979c1ec5e0a28e9c29969ae2c9884 (patch)
tree3b919222ab147741cb9332537997e590b104eb01 /docs/api-reference.md
parent997442c6b99bef99c429d4ab7f676fdf9ae09096 (diff)
improve REST API
Diffstat (limited to 'docs/api-reference.md')
-rw-r--r--docs/api-reference.md40
1 files changed, 22 insertions, 18 deletions
diff --git a/docs/api-reference.md b/docs/api-reference.md
index 7f7a465..064993e 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -89,16 +89,12 @@ Single collection entities can be retrieved using their unique `$fileName` ident
curl http://localhost:8081/api/rest/collection/entity/9474f0eb-06d7-4fd8-b89e-0ce996962508.json | jq .
```
-TODO do not return list
-
```json
-[
- {
- "$fileName": "9474f0eb-06d7-4fd8-b89e-0ce996962508.json",
- "description": "Description of entity 1",
- "name": "Entity 1"
- }
-]
+{
+ "$fileName": "9474f0eb-06d7-4fd8-b89e-0ce996962508.json",
+ "description": "Description of entity 1",
+ "name": "Entity 1"
+}
```
### Retrieving all collection entities
@@ -131,17 +127,19 @@ Updating a collection entity is possible by send only select fields.
```console
curl -X PUT http://localhost:8081/api/rest/collection/entity/ccccc18c-f3dc-4f98-b4d2-290ef76adb6b.json --data @- <<'EOF' | jq .
{
- "description": "Entity 2's description"
+ "description": "Entity 2 description"
}
EOF
```
The endpoint returns the full, updated entity.
-TODO return full, updated entity, return single entity
-
```json
-[]
+{
+ "$fileName": "ccccc18c-f3dc-4f98-b4d2-290ef76adb6b.json",
+ "description": "Entity 2 description",
+ "name": "Entity 2"
+}
```
Fields can be deleted setting them their values to `null`.
@@ -156,10 +154,14 @@ EOF
Again, the response contains the full entity after the update.
-TODO return full, updated entity, return single entity
+TODO sanitize `null` fields
```json
-[]
+{
+ "$fileName": "ccccc18c-f3dc-4f98-b4d2-290ef76adb6b.json",
+ "description": null,
+ "name": "Entity 2"
+}
```
## Retrieving the global schema version
@@ -212,8 +214,10 @@ curl http://localhost:8081/api/rest/schemaVersion | jq .
curl -X DELETE http://localhost:8081/api/rest/collection/entity/9474f0eb-06d7-4fd8-b89e-0ce996962508.json | jq .
```
-TODO return deleted entity, only one entity
-
```json
-[]
+{
+ "$fileName": "9474f0eb-06d7-4fd8-b89e-0ce996962508.json",
+ "description": "Description of entity 1",
+ "name": "Entity 1"
+}
```