API Stability Long-Term

The createRole() GraphQL mutation may be used to add a role. This is usable only if roles are not managed externally (e.g., handled in LDAP).

For more information on roles in LogScale, see the Manage users & permissions documentation page. You may also want to look at the Manage users & permissions page for related information.

Syntax

Below is the syntax for the createRole() mutation field:

graphql
createRole(
      input: AddRoleInput!
   ): AddRoleMutation!

Below is an example of how this mutation field might be used:

Show:
graphql
mutation {
  createRole(input:
      { displayName: "sales",
        viewPermissions: [ReadAccess]
      } )
  { role { id } }
}
Example Responses
Show:
json
{
  "data": {
    "createRole": {
      "role": {
        "id": "pFkHHTbDSlcTo3elkos3Qd0ySW6Kduhb"
      }
    }
  }
}

Given Datatypes

For AddRoleInput, there are a few parameters. Below is a list of them along with descriptions of each:

Table: AddRoleInput

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 17, 2024
colorstring  Long-TermThe color used for highlighting role added.
displayNamestringyes Long-TermThe name to display for the role added.
objectActionObjectAction  Long-TermThe object of the action. See ObjectAction.
organizationManagementPermissions[OrganizationManagementPermission]yes Long-TermThe management permissions for the organization. See OrganizationManagementPermission.
organizationPermissions[OrganizationPermission]yes Long-TermThe permissions for the organization. See OrganizationPermission.
systemPermissions[SystemPermission]yes Long-TermThe permissions for the system. See SystemPermission.
viewPermissions[Permission]yes Long-TermThe permissions for the view. See Permission.

Returned Datatypes

The returned datatype AddRoleMutation has one parameter, but if you click on it below you'll see that it has several sub-parameters:

Table: AddRoleMutation

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Mar 25, 2025
roleGroupyes Long-TermThe role to add. See Group.