Roles

As the name suggest, Role is a Main model in Block-Auth. On this page, we'll dive into the different roles endpoints you can use to manage users programmatically. We'll look at how to query the roles.

The role model

The role model contains all the information about your roles, such as the role name, the role description.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the Role.

  • Name
    slug
    Type
    string
    Description

    The slug of the Role.

  • Name
    name
    Type
    string
    Description

    The name of the Role.

  • Name
    description
    Type
    timestamp
    Description

    The description of the Role.

  • Name
    public
    Type
    boolean
    Description

    Whether the Role is public or not.


GET/api/roles

Get a list of roles

This endpoint allows you to get a list of roles. You can filter the roles by page, limit and search by name.

API - roles

GET
/api/roles?page=1&limit=100
curl --location 'https://api.block-auth.io/api/roles?page=1&limit=100' \
--header 'Authorization: Bearer your_access_token_here' \
--data ''

Response

{
  "success": true,
  "message": {
    "pages": "1",
    "items": [
      {
        "id": 5,
        "slug": "1000-1712512220936-6m1wsu6s",
        "name": "mod",
        "description": "moderator of website",
        "public": 0
      },
      {
        "id": 6,
        "slug": "1000-1712512220936-9t0efpa",
        "name": "admin",
        "description": "administrator of website",
        "public": 0
      },
      {
        "id": 7,
        "slug": "1000-1712512220936-96502v7r",
        "name": "guest",
        "description": "guest of website",
        "public": 0
      },
      {
        "id": 8,
        "slug": "1000-1712512220936-6pdzrszze",
        "name": "client",
        "description": "more than a guest, paying user",
        "public": 0
      }
    ],
    "total": 4
  }
}

Was this page helpful?