Custom Roles
The Custom Roles API allows you to create, manage, and retrieve custom roles for viewers.
List all custom roles
List all custom roles with associated viewers.
Request
curl http://localhost:7472/api/v1/customRoles
Response
[
{
"id": "role1",
"name": "Moderator",
"viewers": ["viewer1", "viewer2"]
},
{
"id": "role2",
"name": "VIP",
"viewers": ["viewer3"]
}
]
Retrieve a custom role
Fetches a specific custom role by its ID. Returns role details and the list of viewers associated with it.
URL Parameters
- Name
customRoleId
- Type
- string
- Description
The ID of the custom role to retrieve.
Request
curl http://localhost:7472/api/v1/customRoles/role1
Response
{
"id": "role1",
"name": "Moderator",
"viewers": ["viewer1", "viewer2"]
}
Add user to custom role
Adds a user to a custom role.
URL Parameters
- Name
customRoleId
- Type
- string
- Description
The ID of the custom role to which the user is being added.
- Name
userIdOrName
- Type
- string
- Description
The ID or username of the viewer to be added to the role.
Query Parameters
- Name
username
- Type
- boolean
- Description
Set to "true" if the user should be found by
username
instead ofuserId
.
Request
curl -X POST http://localhost:7472/api/v1/customRoles/role1/viewer/viewer1?username=true
Response
{
"status": "success",
"message": "Viewer added to custom role"
}
Remove user from custom role
Removes a user from a custom role. You can specify the user by either userId
or username
via query parameter.
URL Parameters
- Name
customRoleId
- Type
- string
- Description
The ID of the custom role to which the user is being removed from.
- Name
userId
- Type
- string
- Description
The ID of the viewer to be removed from the role.
Query Parameters
- Name
username
- Type
- boolean
- Description
Set to "true" if the user should be found by
username
instead ofuserId
.
Request
curl -X DELETE http://localhost:7472/api/v1/customRoles/role1/viewer/viewer1?username=true
Response
{
"status": "success",
"message": "Viewer removed from custom role"
}
Remove all viewers from custom role
Removes all viewers from a custom role.
URL Parameters
- Name
customRoleId
- Type
- string
- Description
The ID of the custom role from which all viewers are being removed.
Request
curl -X DELETE http://localhost:7472/api/v1/customRoles/role1/clear
Response
{
"status": "success",
"message": "All viewers removed from the custom role"
}