Skip to content

Endpoints

Anshul Kushwaha edited this page May 30, 2020 · 1 revision

Success response format

{
    "error": false,
    "data": null
}

Error response format

{
    "error": true,
    "data": null,
    "messages": {
        "firstName": "First Name is required.",
        "lastName": "Last Name is required.",
        "email": "Valid email is required"
    }

GET /model/ [ List ]

Query params

  • query firstName="Anshul"
  • limit integer value, defaults to page size
  • page pagination page
  • sort_by "-createdAt name" will sort by createdAt DESC, name ASC
  • include populated related models, e.g. createdOrganisations in /user/ , members in /organisation/ This can be checked via model and association definitions

Response

{
    "error": false,
    "data": {
        "rows": [
            {
                "id": 2,
                "firstName": "1",
                "lastName": "one",
                "email": "[email protected]",
                "phone": null,
                "password": null,
                "isEmailVerified": null,
                "isPhoneVerified": null,
                "createdAt": "2020-05-30T18:35:10.000Z",
                "updatedAt": "2020-05-30T18:35:10.000Z",
                "deletedAt": null
            },
            {
                "id": 3,
                "firstName": "2",
                "lastName": "two",
                "email": "[email protected]",
                "phone": null,
                "password": null,
                "isEmailVerified": null,
                "isPhoneVerified": null,
                "createdAt": "2020-05-30T18:35:18.000Z",
                "updatedAt": "2020-05-30T18:35:18.000Z",
                "deletedAt": null
            }
        ],
        "count": 8,
        "page": 1,
        "page_size": 2,
        "limit": 2
    }
}

POST /model/ [ Create ]

GET /model/:id [ Retrieve ]

Supports include as described in [ List ] above.

PATCH /model/:id [ Update ]

DELETE /model/:id [ Delete ]

Soft deletes entry with id specified.