Skip to main content
GET
/
api
/
roles
curl -X GET "https://api.maqagr.com/api/roles?page=1&limit=10" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "success": true,
  "message": "Roles obtenidos exitosamente",
  "data": {
    "roles": [
      {
        "role_id": 1,
        "role_name": "admin",
        "description": "Administrator role with full access",
        "status": "active",
        "created_at": "2024-01-01T00:00:00.000Z",
        "updated_at": "2024-01-01T00:00:00.000Z"
      },
      {
        "role_id": 2,
        "role_name": "user",
        "description": "Standard user role",
        "status": "active",
        "created_at": "2024-01-01T00:00:00.000Z",
        "updated_at": "2024-01-01T00:00:00.000Z"
      }
    ],
    "pagination": {
      "currentPage": 1,
      "totalPages": 1,
      "totalItems": 3,
      "itemsPerPage": 10
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/David9604/BackMaqagr/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Retrieves all active roles in the system with pagination support. Any authenticated user can view the list of roles.

Authentication

Requires JWT authentication token in the Authorization header.
Authorization: Bearer <token>

Query Parameters

page
integer
default:"1"
Page number for pagination.
limit
integer
default:"10"
Number of records per page. Maximum: 50.

Response

success
boolean
Indicates if the request was successful.
message
string
Success message.
data
object
curl -X GET "https://api.maqagr.com/api/roles?page=1&limit=10" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "success": true,
  "message": "Roles obtenidos exitosamente",
  "data": {
    "roles": [
      {
        "role_id": 1,
        "role_name": "admin",
        "description": "Administrator role with full access",
        "status": "active",
        "created_at": "2024-01-01T00:00:00.000Z",
        "updated_at": "2024-01-01T00:00:00.000Z"
      },
      {
        "role_id": 2,
        "role_name": "user",
        "description": "Standard user role",
        "status": "active",
        "created_at": "2024-01-01T00:00:00.000Z",
        "updated_at": "2024-01-01T00:00:00.000Z"
      }
    ],
    "pagination": {
      "currentPage": 1,
      "totalPages": 1,
      "totalItems": 3,
      "itemsPerPage": 10
    }
  }
}

Source Code Reference

  • Route: src/routes/role.routes.js:93
  • Controller: src/controllers/roleController.js:22

Build docs developers (and LLMs) love