Assign a role
const url = 'https://example.com/api/v1/role-assignments';const options = { method: 'POST', headers: { cookie: '__Host-shardkeep_session=<__Host-shardkeep_session>', 'Content-Type': 'application/json' }, body: '{"roleId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","userId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","teamId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","scope":{"kind":"GLOBAL","teamId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","serverId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/role-assignments \ --header 'Content-Type: application/json' \ --cookie __Host-shardkeep_session=<__Host-shardkeep_session> \ --data '{ "roleId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "userId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "teamId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "scope": { "kind": "GLOBAL", "teamId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "serverId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } }'Give a role to exactly one of a user or a team, at a global, team or server scope. Node permissions only take effect at global scope.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Set exactly one of userId and teamId.
object
Where an assignment applies. GLOBAL covers everything; TEAM covers the
servers the team owns (set teamId); SERVER covers one server (set
serverId).
object
Responses
Section titled “Responses”Role assigned.
object
Where an assignment applies. GLOBAL covers everything; TEAM covers the
servers the team owns (set teamId); SERVER covers one server (set
serverId).
object
Example
{ "scope": { "kind": "GLOBAL" }}The request is invalid.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Not signed in, or the credentials are invalid.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Signed in, but not allowed.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Clashes with existing data or state.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Shardkeep is free software under the AGPL-3.0. Minecraft is a trademark of Mojang AB; Shardkeep is not affiliated with or endorsed by Mojang or Microsoft.