Skip to main content

Create a Role

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
let role = { "name": { "en-GB": "Movie Editors" }, "description": { "en-GB": "Movie editors can edit movies, but not submit or approve them" }, "enabled": true, "permissions": { "entries": [ { "id": "movie", "languages": ["en-GB"], "actions": ["sys.update", "awaitingApproval.revoke"] } ], "contentTypes": [] }, "assignments": { "users": ["a.user"], "groups": ["Movie Editors"], "apiKeys": ["Movie Import"] } }; client.roles.create(role) .then(result => { console.log('API call result: ', result); }) .catch(error => { console.log('API call fetch error: ', error); });
JSON
1
2
3
4
5
6
7
8
9
10
11
{ "logId": "00000000-0000-0000-0000-000000000000", "message": "There are validation errors creating the role", "data": [ { "field": "projectId", "message": "The project does not exist" } ], "type": "Validation" }
JSON
1
2
3
4
5
6
7
8
9
10
{ "logId": "00000000-0000-0000-0000-000000000000", "message": "There are validation errors creating the role", "data": [ { "message": "Access denied" } ], "type": "Validation" }
JSON
1
2
3
4
5
6
7
8
9
10
11
{ "logId": "00000000-0000-0000-0000-000000000000", "message": "There are validation errors creating the role", "data": [ { "field": "entries[index].id", "message": "The content type 'movie' does not exist" } ], "type": "Validation" }
JSON
1
2
3
4
5
6
7
8
9
10
11
{ "logId": "00000000-0000-0000-0000-000000000000", "message": "There are validation errors creating the role", "data": [ { "field": "Role.Permissions.Entries[index]", "message": "The languages 'cy', 'fr' specified in the role are not supported by the content type." } ], "type": "Validation" }

Still need help?

New support request