This is a application which serves as a mock for persisting data to a database. It mirrors the implementation of the Zuri Core application
- Endpoint-> POST
/api/data/write
- Sample Payload->
{
"plugin_id": "reminders_id",
"organization_id": "Darwin_organization",
"collection_name": "Reminders",
"bulk_write": false,
"object_id":"612fa7721112f088962c76ad",
"filter": {
"priority": 1,
"shouldRemind": true
},
"payload": {
"priority": 2,
"expiryDate": "01-01-2021",
"description": "Obi is a boy",
"shouldRemind": true
}
}
- Responses
-
Success response-> 200
{ "success": true, "message": "0 document(s) found and 0 document(s) modified." }
-
Error response-> 422
{ "error": "Invalid Payload Format. Expected an Array" }
-
- Endpoint-> PUT
/api/data/write
- Sample Payload->
{
"plugin_id": "reminders_id",
"organization_id": "Darwin_organization",
"collection_name": "Reminders",
"bulk_write": false,
"object_id":"612fa7721112f088962c76ad",
"filter": {
"priority": 1,
"shouldRemind": true
},
"payload": {
"priority": 2,
"expiryDate": "01-01-2021",
"description": "Obi is a boy",
"shouldRemind": true
}
}
- Responses
-
Success response-> 200
{ "success": true, "message": "0 document(s) found and 0 document(s) modified." }
-
Error response-> 422
{ "error": "Invalid Payload Format. Expected an Array" }
-
- Endpoint-> DELETE
/api/data/write
- Sample Payload (delete One)->
{
"plugin_id": "reminders_id",
"organization_id": "Darwin_organization",
"collection_name": "Reminders",
"object_id":"612fa7721112f088962c76ad"
}
- Responses
-
Success response-> 200
{ status: "success", "message": "Data deleted" }
-
Error response-> 422
{ "error": "Invalid Delete Request. object_id is needed" }
-
- Endpoint-> POST
/api/data/read/:plugin_id/:collection_name/:organization_id?object_id
- Sample Payload->
"filter": {
"priority": 1,
"shouldRemind": true
}
- Responses
-
Success response-> 201
{ "result": [ { "_id": "6130eeb9b9944cff3b518cc7", "plugin_id": "reminders_id", "organization_id": "Darwin_organization", "collection_name": "Reminders", "payload": { "priority": 1, "expiryDate": "03-01-2021", "description": "Obiina is a boy", "shouldRemind": false }, }, { "_id": "6130eebeb9944cff3b518ccc", "plugin_id": "reminders_id", "organization_id": "Darwin_organization", "collection_name": "Reminders", "payload": { "priority": 5, "expiryDate": "08-01-2020", "description": "ade is a winner", "shouldRemind": true }, } ] }
-
Error response-> 422
{ success: false, errResponse: error.response }
-
-
Endpoint-> GET
/api/data/read/:plugin_id/:collection_name/:organization_id
-
Responses
-
Success response-> 201
{ "result": [ { "_id": "6130eeb9b9944cff3b518cc7", "plugin_id": "reminders_id", "organization_id": "Darwin_organization", "collection_name": "Reminders", "payload": { "priority": 1, "expiryDate": "03-01-2021", "description": "Obiina is a boy", "shouldRemind": false }, }, { "_id": "6130eebeb9944cff3b518ccc", "plugin_id": "reminders_id", "organization_id": "Darwin_organization", "collection_name": "Reminders", "payload": { "priority": 5, "expiryDate": "08-01-2020", "description": "ade is a winner", "shouldRemind": true }, } ] }
-
Error response-> 422
{ success: false, error: error.response }
-
-
Endpoint-> GET
/api/data/read/:plugin_id/:collection_name/:organization_id?object_id
-
Responses
-
Success response-> 201
{ "result": [ { "_id": "6130eeb9b9944cff3b518cc7", "plugin_id": "reminders_id", "organization_id": "Darwin_organization", "collection_name": "Reminders", "payload": { "priority": 1, "expiryDate": "03-01-2021", "description": "Obiina is a boy", "shouldRemind": false }, "createdAt": "2021-09-06T11:46:21.230Z", "updatedAt": "2021-09-06T11:59:55.896Z" } ] }
-
Error response-> 422
{ success: false, error: error.response }
-