curl -X POST 'https://api.example.com/role-permissions' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"roleId": "role_123",
"permissionId": "perm_456"
}'
const axios = require('axios');
const { data } = await axios.post('https://api.example.com/role-permissions', {
roleId: 'role_123',
permissionId: 'perm_456',
}, {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
});
{
"id": "rp_789",
"roleId": "role_123",
"permissionId": "perm_456"
}
Role Permissions
Create Role Permission
Assign a permission to a role
POST
/
role-permissions
curl -X POST 'https://api.example.com/role-permissions' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"roleId": "role_123",
"permissionId": "perm_456"
}'
const axios = require('axios');
const { data } = await axios.post('https://api.example.com/role-permissions', {
roleId: 'role_123',
permissionId: 'perm_456',
}, {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
});
{
"id": "rp_789",
"roleId": "role_123",
"permissionId": "perm_456"
}
Request Body
string
required
The role ID to assign the permission to
string
required
The permission ID to assign
Response
Returns the created role-permission mapping object.curl -X POST 'https://api.example.com/role-permissions' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"roleId": "role_123",
"permissionId": "perm_456"
}'
const axios = require('axios');
const { data } = await axios.post('https://api.example.com/role-permissions', {
roleId: 'role_123',
permissionId: 'perm_456',
}, {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
});
{
"id": "rp_789",
"roleId": "role_123",
"permissionId": "perm_456"
}
Was this page helpful?
⌘I