Skip to content

Role ​

INFO

Every response arrives in the shared envelope — code, message, messages, status_code, time — with the payload in data. The tables below describe what is inside data.

POST /role/create ​

Create a role with its permission access map.

Request body

FieldTypeRequiredDescription
namestringYesRole name
accessobjectYespermission map: key → access degree (a|s|r|d)
web_accessobjectNopermission map for the web back-office surface
mobile_accessobjectNopermission map for the mobile/POS surface
json
{
  "name": "string",
  "access": {},
  "web_access": {},
  "mobile_access": {}
}

Response

FieldTypeDescription
_idstring
namestring
webboolean
mobileboolean
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "web": false,
    "mobile": false
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /role/update ​

Update an existing role and its permission access map.

Request body

FieldTypeRequiredDescription
namestringYesRole name
accessobjectYespermission map: key → access degree (a|s|r|d)
web_accessobjectNopermission map for the web back-office surface
mobile_accessobjectNopermission map for the mobile/POS surface
_idstringYes
json
{
  "name": "string",
  "access": {},
  "web_access": {},
  "mobile_access": {},
  "_id": "string"
}

Response

Same response shape as POST /role/create.

DELETE /role/delete/{id} ​

Delete a role

Path parameters

ParameterTypeRequiredDescription
idstringYes

Request body

No request body.

Response

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}

GET /role/get-by-id/{id} ​

Get role using its _id

Path parameters

ParameterTypeRequiredDescription
idstringYes

Request body

No request body.

Response

Same response shape as POST /role/create.

POST /role/get-paging ​

Get roles by paging

Request body

FieldTypeRequiredDescription
pagenumberYesDefault: 1
limitnumberYesDefault: 20
searchstringNo
ninstring[]No
json
{
  "page": 1,
  "limit": 20,
  "search": "string",
  "nin": [
    "63f8b0c4e4b0d3a2f8e4b0c4"
  ]
}

Response

data.total is the total number of records and data.data[] holds the current page. The table below describes one record.

FieldTypeDescription
_idstring
namestring
webboolean
mobileboolean
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "_id": "string",
        "name": "string",
        "web": false,
        "mobile": false
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

This page is generated from the OpenAPI spec.

Bito 2.0 Integration API