Invoke CRUD externally

A simple summary on how to use CRUD operations in a Recipe

post
Create

Create a new entity
Request
Response
Request
Body Parameters
optional
string
Response
200: OK
Saved entity
{
"name": "Jane Doe",
"buildableId": "5f8a13b930c301d2d3f04f9f",
"author": {
"_id": "anonymous"
},
"createdAt": 1602885374217,
"slug": "jane-doe",
"_id": "5f8a16fe1182200011af459c"
}

post
List

List entities by filters and pagination results
Request
Response
Request
Body Parameters
fields
optional
array
Fields filter
page
optional
number
Page number
pageSize
optional
number
Size of a page
sort
optional
string
Sorted fields
query
optional
object
Query object that is passed to the database
Response
200: OK
List of found entities and count
{
"rows": [
{
"_id": "5f8a3d9367764b0011f881f8",
"name": "Job1",
"buildableId": "5f8a13b930c301d2d3f04f9f",
"author": {
"_id": "anonymous"
},
"createdAt": 1602895251836
},
{
"_id": "5f8a35c267764b0011f8811d",
"name": "CTO",
"buildableId": "5f8a13b930c301d2d3f04f9f",
"author": {
"_id": "anonymous"
},
"createdAt": 1602893250531,
"updatedAt": 1602894172189
},
{
"_id": "5f8a2ad567764b0011f88034",
"name": "Doctor",
"buildableId": "5f8a13b930c301d2d3f04f9f",
"author": {
"_id": "anonymous"
},
"createdAt": 1602890453653

post
Update

Update an entity by ID
Request
Response
Request
Body Parameters
id
required
string
ID of entity
...rest
optional
string
Any other field to be updated
Response
200: OK
Updated entity
{
"_id": "5f8a3d9367764b0011f881f8",
"name": "Some other job",
"buildableId": "5f8a13b930c301d2d3f04f9f",
"author": {
"_id": "anonymous"
},
"createdAt": 1602895251836,
"updatedAt": 1602895351667
}

post
Remove

Remove an entity by ID
Request
Response
Request
Body Parameters
id
required
string
ID of entity
Response
200: OK
Count of removed entities
{
"_id": "5f8a3d9367764b0011f881f8",
"name": "Some other job",
"buildableId": "5f8a13b930c301d2d3f04f9f",
"author": {
"_id": "anonymous"
},
"createdAt": 1602895251836,
"updatedAt": 1602895351667
}

post
Get

Get entity by ID
Request
Response
Request
Body Parameters
id
required
string
ID of entity
fields
optional
string
Fields filter
Response
200: OK
Found entities

post
Count

Get count of entities in a query
Request
Response
Request
Body Parameters
query
required
object
Query object that is passed to the database
Response
200: OK
Count of found entities