Document Management

To show the servers API curl will be used to interact with the database. The examples assume the server to be running on the some host and listening on the port 1338.

The examples will query the fictional Database myDb. Replace this with the identifier of the Database you want to use.

Add a Document

If the Document body is a JSON string it is important to tell curl to send the appropriate header (--header "Content-Type:application/json")

curl --header "Content-Type:application/json" \
    -X POST http://127.0.0.1:1338/myDb \
    -d '{
    "name": "T-Shirt - Stairtower",
    "type": "clothes",
    "category": "merchandise",
    "price": 12.50,
    "options": {
        "colors": ["green", "red", "blue"],
        "size": ["xs", "s", "m", "l"]
        }
    }'

Update a Document

Documents are updated by sending a PUT request to the Documents resource URI.

Update requests do NOT patch a Document but will replace it completely.

curl --header "Content-Type:application/json" \
    -X PUT http://127.0.0.1:1338/myDb/document_identifier \
    -d '{
    "name": "T-Shirt - Stairtower",
    "type": "clothes",
    "category": "merchandise",
    "price": 13.50,
    "options": {
        "colors": ["green", "red", "blue"],
        "size": ["xs", "s", "m", "l"]
        }
    }'

Delete a Document

Documents are deleted by sending a DELETE request to the Documents resource URI.

curl -X DELETE http://127.0.0.1:1338/myDb/document_identifier

Read all Documents

Return all Documents without filtering

curl http://127.0.0.1:1338/myDb

Query by ID

Retrieve a single Document by it's resource URI, which is built from the Database identifier and the Document identifier (e.g. myDb/f1e248d4615f716a3612d09ed2c).

curl http://127.0.0.1:1338/myDb/document_identifier

Search & Filter

Learn more about filtering Documents.