Get All User Roles API
POST /getAllUserRoles
Description
This API endpoint retrieves a list of all user roles available in the system, including their IDs and names.
Request Body
The request utilizes GraphQL to perform the getAllUserRoles
query.
Query:
query getAllUserRoles {
getAllUserRoles {
id
name
}
}
Variables:
{}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query getAllUserRoles {\n getAllUserRoles {\n id\n name\n }\n}","variables":{}}'
Response:
-
Success (200 OK):
- The response contains a list of all user roles with their respective IDs and names.
{
"data": {
"getAllUserRoles": [
{
"id": "<Role_ID_1>",
"name": "<Role_Name_1>"
},
{
"id": "<Role_ID_2>",
"name": "<Role_Name_2>"
}
// More roles...
]
}
} -
Error (4XX/5XX):
- If there is an issue with retrieving the user roles, such as authentication errors or server errors, the response will include an appropriate error message and status code.
Note:
Ensure that the request is authenticated if required, as some systems might restrict access to role information based on user permissions.