API Stability Long-Term

The rolesPage() GraphQL query is used to get searchable paginated roles.

Similar to this query, there is the roles query. Related to both queries, there is the rolesInOrgForChangingUserAccess() to get the roles for a user.

There are also the mutations createRole(), and removeRole() for creating and removing a role. And there is the mutation updateDefaultRole() for updating the default role for a group.

For more information on roles in LogScale, see the Manage Users and Permissions documentation page. You may also want to look at the Manage Users and Permissions page for related information.

Syntax

graphql
rolesPage(
     search: string,
     typeFilter: [PermissionType],
     includeHidden: boolean,
     pageSize: integer!,
     pageNumber: integer!
   ): RolePage!

For search, you can provide a string on which to search, text that may be in the name of the roles you want to find (e.g., sales_ for roles for the sales department). For typeFilter you would select from a list of permission types (e.g., permissions based on views) — you can select multiple types. Use the includeHidden to indicate if hidden views should be included.

For the pageSize, specify the number of records you want per page. Use pageNumber to specify which page to return — assuming the results would cover multiple pages.

For the results, you can request plenty of details about each role. See the Returned Datatype section further down this page for more information on this.

Example

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

Raw
graphql
query {
  rolesPage(search: "member", pageSize: 10, pageNumber: 1)
  {pageInfo {total, totalNumberOfRows}, page {
    id, displayName, usersCount, viewPermissions
  }}
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "query {
  rolesPage(search: \"member\", pageSize: 10, pageNumber: 1)
  {pageInfo {total, totalNumberOfRows}, page {
    id, displayName, usersCount, viewPermissions
  }}
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "query {
  rolesPage(search: \"member\", pageSize: 10, pageNumber: 1)
  {pageInfo {total, totalNumberOfRows}, page {
    id, displayName, usersCount, viewPermissions
  }}
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "query { ^
  rolesPage(search: \"member\", pageSize: 10, pageNumber: 1) ^
  {pageInfo {total, totalNumberOfRows}, page { ^
    id, displayName, usersCount, viewPermissions ^
  }} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
  rolesPage(search: \"member\", pageSize: 10, pageNumber: 1)
  {pageInfo {total, totalNumberOfRows}, page {
    id, displayName, usersCount, viewPermissions
  }}
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "query {
  rolesPage(search: \"member\", pageSize: 10, pageNumber: 1)
  {pageInfo {total, totalNumberOfRows}, page {
    id, displayName, usersCount, viewPermissions
  }}
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "query {
  rolesPage(search: \"member\", pageSize: 10, pageNumber: 1)
  {pageInfo {total, totalNumberOfRows}, page {
    id, displayName, usersCount, viewPermissions
  }}
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "query {
  rolesPage(search: \"member\", pageSize: 10, pageNumber: 1)
  {pageInfo {total, totalNumberOfRows}, page {
    id, displayName, usersCount, viewPermissions
  }}
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "rolesPage": {
      "pageInfo": {
        "total": 1,
        "totalNumberOfRows": 1
      },
      "page": [
        {
          "id": "pFLOxe7C8zkNbWOSP8VartJ0I6Kz0eK2",
          "displayName": "Member",
          "usersCount": 14,
          "viewPermissions": [
            "ChangeDashboards",
            "ChangeSavedQueries",
            "ChangeTriggers",
            "ChangeFiles",
            "ChangeParsers",
            "ReadAccess"
          ]
        }
      ]
    }
  }
}

Given Datatype

The given datatype is an enumerated list of permission types (e.g., permission for an asset, or based on a view). Below is a list of them along with descriptions of each:

Table: PermissionType

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Oct 3, 2025
AssetPermission   Long-TermThe type of permission is related to assets.
OrganizationManagementPermission   Long-TermThe permission is for the management of an organization.
OrganizationPermission   Long-TermThe permission is based on an organization.
SystemPermission   Long-TermThe permission is for the system.
ViewPermission   Long-TermThe permission is for a view.

Returned Datatype

The returned datatype allows for a couple of parameters, one of which uses the Role datatype, which leads to plenty of details about each role. The table below lists the two parameters and a link to the sub-parameters:

Table: RolePage

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Mar 17, 2025
page[Role]yes Long-TermThe roles to include in the page. See Role.
pageInfoPageTypeyes Long-TermThe page settings. See PageType.