See an example of how to create a new role in Aurora.
You can create a new role using a mutation request through the GraphQL API. In this guide, we will show an example mutation that creates a new role and the expected response once the role has been successfully added.
Example Request
mutation createRole($createInput: createRoleInput!) {
createRole(createInput: $createInput) {
result {
id
name
}
}
}
The mutation here initiates a createRole
function using information passed through GraphQL variables. Here is an example of the variables we use to create our new role.
{
"createInput": {
"Key": {
"roleName": "<ROLE-NAME>",
"featureId": "<FEATURE-ID>",
"nodeId": "<NODE-ID>"
},
"Description": "<DESCRIPTION>"
}
}
Here is a breakdown of the objects and fields used to create the input necessary to create the new role:
Name | Description |
---|---|
nodeId | If not specified, Aurora will assume the role is at the community level and not scoped to a lower core node. |
featureId | The ID of the feature to identify the role. Valid values include core and memberships .memberships is used when the role relates to a Group Hub. core indicates the role is used across the system. |
roleName | The roleName field provides a name for the role which will be displayed in the Settings > Users area of the Admin. |
description | The description field adds additional information for the role, which will appear in the Settings > Users area of the Admin. |
Example Response
A successful 200 response should include all of the information requested in the initial request. For the above example, we should receive the following response:
{
"data": {
"createRole": {
"result": {
"id": "role:t:example-role",
"name": "Example Role",
"feature": {
"id": "core"
}
}
}
}
}
The results, as requested, include the id
, name
, and feature
id
for the new role. The new role is now available to use.
ATLAS
Comments