Endpoints

Folk our postman collection to speed up development

For every table in your database, you will automatically have access to the following endpoints:

Create One

Endpoint: */

Example Request:

POST `/User/`

Body {
    "email": "email@email.com",
    "password": "example",
    "role": "ADMIN",
    "firstName": "Jon",
    "lastName": "Doe",
}

Example Response:

{
    "id": 1,
    "email": "email@email.com",
    "password": "*",
    "role": "ADMIN",
    "firstName": "Jon",
    "lastName": "Doe",
    "createdAt": "{{date}}",
    "updatedAt": "{{date}}"
    "deletedAt": null,
}

Create Many

Endpoint: */

Example Request:

POST `/User/`

Body [{
    "email": "email@email.com",
    "password": "example",
    "role": "ADMIN",
    "firstName": "Jon",
    "lastName": "Doe",
},{
    "email": "email2@email.com",
    "password": "example",
    "role": "ADMIN",
    "firstName": "Jane",
    "lastName": "Doe",
}]

Example Response:

{
    "total": 2,
    "success": 2,
    "errored": 0,
    "errors": [],
    "data": [...records]
}

Read One

Endpoint: */:id

Example Request:

GET `/User/1?fields=role,id`

Example Response:

{   
    "role":"ADMIN",
    "id":1
}

Read Many

Endpoint: */

GET `/User/list`

Response Schema:

{
    "limit": number, //records returned for this page
    "offset": number, //the current offset value
    "total": number, //total records for all pages
    "pagination": {}, //see pagination
    "data": [...records]
}

Read Table Schema

Read the database schema for a specific table

Endpoint: */schema

GET `/User/schema`

Example Response:

{
    "table": "User",
    "primary_key": "id",
    "columns": [
        {
            "field": "id",
            "type": "number",
            "nullable": false,
            "required": true,
            "primary_key": true,
            "unique_key": false,
            "foreign_key": false,
            "default": null,
            "extra": "auto_increment"
        },
        ...
        {
            "field": "deletedAt",
            "type": "date",
            "nullable": true,
            "required": false,
            "primary_key": false,
            "unique_key": false,
            "foreign_key": false,
            "default": null,
            "extra": ""
        }
    ],
    "relations": [
        {
            "table": "UserApiKey",
            "column": "userId",
            "org_table": "User",
            "org_column": "id"
        }
    ]
}

Read Tables

Get a list of tables in your database

Endpoint: /tables

GET `/tables`

Example Response:

{
    "tables": [
        "Customer",
        "Employee",
        "UserApiKey",
        "SalesOrder",
        "Shipper",
        "User"
    ]
}

Update One

Endpoint: */:id

Example Request:

PUT `/User/1`

Body {
    "firstName": "Jane",
}

Example Response:

{
    "id": 1,
    "email": "email@email.com",
    "password": "example",
    "role": "ADMIN",
    "firstName": "Jane",
    "lastName": "Doe",
    "createdAt": "{{date}}",
    "updatedAt": "{{date}}"
    "deletedAt": null,
}

Update Many

Endpoint: */

Example Request:

PUT `/User/`

Body [{
    "id": 1,
    "firstName": "John",
},{
    "id": 2,
    "firstName": "Janie",
}]

Example Response:

{
    "total": 2,
    "success": 2,
    "errored": 0,
    "errors": [],
    "data": [...records]
}

Delete One

Endpoint: */:id

Example Request:

DELETE `/User/1`

Example Response:

{
    "deleted": 1
}

Delete Many

Endpoint: */

Example Request:

DELETE `/User/`

Body [{
    "id": 1,
},{
    "id": 2,
}]

Example Response:

{
    "total": 2,
    "deleted": 2,
    "errored": 0,
    "errors": []
}