Skip to content

Role Endpoint

CristiPV edited this page Oct 13, 2021 · 4 revisions

Wiki ▸ Endpoints ▸ Role

Role

Contains data of all roles available on our e-learning platform.

The Role endpoint is a representation of the roles added to the application. The endpoint's purpose is to facilitate accessing, creating, updating and deleting these resources.

Endpoints

GET /roles/

Retrieves all the entries

Sample response

Status code: 200
Body:

[
    {
        "id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
        "name": "ROLE_EXAMPLE"
    },
    {
        "id": "7b1d518c-8106-41e4-800f-fb14c38671f6",
        "name": "ROLE_NAME"
    }
]

GET /roles/:id

Retrieves the entry with the provided id

Parameters

Path Parameters

Path Parameter Description
:id The id of the role entry.

Sample response

Status code: 200
Body:

{
    "id": "662d426a-cfb9-4f9e-ac50-ae719194257d",
    "name": "ROLE_NAME"
}

Status code: 404
Body:

{
    "error": "Not Found"
}

POST /roles/

Creates a new entry

Sample response

Status code: 201
Request Body:

{
    "name": "ROLE_EXAMPLE"
}

Response Body:

{
    "id": "6a144d71-f7dc-4203-bb66-c280bde12350",
    "name": "ROLE_EXAMPLE"
}

Status code: 400

Request Body:

{
    "name": "",
}

Response Body:

{
    "error": "POST: Role Invalid Name",
}

PATCH /roles/:id

Edits the entry with the provided id

Parameters

Path Parameters

Path Parameter Description
:id The id of the role entry.

Sample response

Status code: 200
Request Body:

{
    "name": "ROLE_EXAMPLE_EDITED"
}

Response Body:

{
    "id": "6a144d71-f7dc-4203-bb66-c280bde12350",
    "name": "ROLE_EXAMPLE_EDITED"
}

Status code: 400

Request Body:

{
    "name": "",
}

Response Body:

{
    "error": "POST: Role Invalid Name",
}

Status code: 404

Request Body:

{
    "name": "ROLE_EXAMPLE",
}

Response Body:

{
    "error": "Role not found",
}

DELETE /roles/:id

Deletes the entry with the provided id

Parameters

Path Parameters

Path Parameter Description
:id The id of the role entry.

Sample response

Status code: 200

Body:

Status code: 404

Body:

{
    "error": "Not Found",
}

Getting Started

Conventions

  1. General

  1. REST API

  1. E-Learning App

Endpoints

Custom Components

Themes

Packages Used

  1. Global

  1. REST API

  1. E-Learning App

Clone this wiki locally