Document Operations

Document operations are action endpoints on a collection.

Authentication

Requires Api-Key and Api-Secret, or a Glue owner token where the database owner is allowed.

Path Parameters

Parameter Type Description
databaseId uuid The unique identifier of the database
collection string The collection name
documentId string The document ID, for get-by-ID requests

Insert: {collection}:insert

1POST /v1/databases/a1b2c3d4-e5f6-7890-abcd-ef1234567890/collections/users:insert HTTP/1.1
2Host: api.hola.cloud
3Api-Key: 1abbe476-6ad6-4b97-9cca-6deb6ab2901d
4Api-Secret: 4bda6d52-762b-4e5d-bed7-85614c13b8bf
5Content-Type: application/jsonl
6
7{"id":"user-1","name":"Alice","role":"admin"}
8{"id":"user-2","name":"Bob","role":"member"}

Response:

1{"id":"user-1","name":"Alice","role":"admin"}
2{"id":"user-2","name":"Bob","role":"member"}

Find: {collection}:find

 1POST /v1/databases/a1b2c3d4-e5f6-7890-abcd-ef1234567890/collections/users:find HTTP/1.1
 2Host: api.hola.cloud
 3Api-Key: 1abbe476-6ad6-4b97-9cca-6deb6ab2901d
 4Api-Secret: 4bda6d52-762b-4e5d-bed7-85614c13b8bf
 5Content-Type: application/json
 6
 7{
 8  "filter": {
 9    "role": "admin"
10  }
11}

Response:

1{"id":"user-1","name":"Alice","role":"admin"}

Get by ID

1GET /v1/databases/a1b2c3d4-e5f6-7890-abcd-ef1234567890/collections/users/documents/user-1 HTTP/1.1
2Host: api.hola.cloud
3Api-Key: 1abbe476-6ad6-4b97-9cca-6deb6ab2901d
4Api-Secret: 4bda6d52-762b-4e5d-bed7-85614c13b8bf

Response:

1{"id":"user-1","name":"Alice","role":"admin"}

Patch: {collection}:patch

 1POST /v1/databases/a1b2c3d4-e5f6-7890-abcd-ef1234567890/collections/users:patch HTTP/1.1
 2Host: api.hola.cloud
 3Api-Key: 1abbe476-6ad6-4b97-9cca-6deb6ab2901d
 4Api-Secret: 4bda6d52-762b-4e5d-bed7-85614c13b8bf
 5Content-Type: application/json
 6
 7{
 8  "filter": {
 9    "id": "user-1"
10  },
11  "patch": {
12    "role": "owner"
13  }
14}

Response:

1{"id":"user-1","name":"Alice","role":"owner"}

Remove: {collection}:remove

 1POST /v1/databases/a1b2c3d4-e5f6-7890-abcd-ef1234567890/collections/users:remove HTTP/1.1
 2Host: api.hola.cloud
 3Api-Key: 1abbe476-6ad6-4b97-9cca-6deb6ab2901d
 4Api-Secret: 4bda6d52-762b-4e5d-bed7-85614c13b8bf
 5Content-Type: application/json
 6
 7{
 8  "filter": {
 9    "id": "user-2"
10  }
11}

Response:

1{"id":"user-2","name":"Bob","role":"member"}

Comments

Leave a comment