The groupByDisplayName() GraphQL query groups results by a given display name.

For more information on user groups, see the Manage Groups documentation page.

Syntax

Below is the syntax for the groupByDisplayName() query field:

graphql
groupByDisplayName(
     displayName: string!
   ): Group!

To be able to get information on a particular group, with this query you have to provide the display name of the group.

For the return value Group, you'll need to specify at least one of its parameters (see the Returned Datatypes section below). Here's an example for more clarity:

Raw
graphql
query{
  groupByDisplayName(displayName: "chiefs") {
    id, users {
      id, username, displayName
    }
  }
}
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{
  groupByDisplayName(displayName: \"chiefs\") {
    id, users {
      id, username, displayName
    }
  }
}"
}
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{
  groupByDisplayName(displayName: \"chiefs\") {
    id, users {
      id, username, displayName
    }
  }
}"
}
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{ ^
  groupByDisplayName(displayName: \"chiefs\") { ^
    id, users { ^
      id, username, displayName ^
    } ^
  } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query{
  groupByDisplayName(displayName: \"chiefs\") {
    id, users {
      id, username, displayName
    }
  }
}"
}'
"$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $INGEST_TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $json = '{"query" : "query{
  groupByDisplayName(displayName: \"chiefs\") {
    id, users {
      id, username, displayName
    }
  }
}"
}';
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{
  groupByDisplayName(displayName: \"chiefs\") {
    id, users {
      id, username, displayName
    }
  }
}"
}'''

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{
  groupByDisplayName(displayName: \"chiefs\") {
    id, users {
      id, username, displayName
    }
  }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL/graphql',
  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": {
    "groupByDisplayName": {
      "id": "BHdJstvjgDUjXg10KrbjiybpSbOHIw1b",
      "users": [
        {
          "id": "czN4YDhpmZ1JrZnJ4bkQzK52",
          "username": "tom",
          "displayName": "Tom Hanks"
        },
        {
          "id": "mQ2oDkHSLhTG6l6ppsmxJYHJ",
          "username": "steve",
          "displayName": "Steve McQueen"
        },
        {
          "id": "TMc2x9a2APnkGvyMJQbxgcOU",
          "username": "bob",
          "displayName": "Bob Newhart"
        }
      ]
    }
  }
}

This example requests first the ID for the group, then a list or array of users in the group. For each user, it calls for the user's ID, the user name, and the display name of the user.

Returned Datatypes

The returned datatype group has its own parameters. Below is a list of them along with their datatypes and a description of each:

Table: Group

ParameterTypeRequiredDefaultDescription
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.
assetPermissionsmultipleyes Get asset permissions assigned to the group for the specific asset. The datatype consists of (assetId: string!, assetType: AssetPermissionsAssetType!, searchDomainId: string): AssetPermissionsForGroup!. See AssetPermissionsAssetType and AssetPermissionsForGroup.
defaultQueryPrefixstring  The default prefix for queries.
defaultRoleRole  The default role associated with the group (see Role).
defaultSearchDomainCountintegeryes The default search domain count.
displayNamestringyes The display name of the group.
idstringyes The identifier of the group.
lookupNamestring  The look-up name for the group.
organizationRoles[GroupOrganizationRole]yes The roles of the organization associated with the group (see GroupOrganizationRole Table).
queryPrefixes[QueryPrefixes]yes The query prefixes for the group. queryPrefixes(onlyIncludeRestrictiveQueryPrefixes: Boolean, onlyForRoleWithId: String): [QueryPrefixes!]! See QueryPrefixes.
roles[SearchDomainRole]yes The roles for the group (see SearchDomainRole).
searchAssetPermissionsmultipleyes Search for asset permissions for the group. This is a preview and subject to change. The datatype consists of (searchFilter: string, skip: integer, limit: integer, orderBy: OrderBy, sortBy: SortBy, assetTypes: [AssetPermissionsAssetType!], searchDomainIds: [string!], permissions: [AssetPermissionInputEnum!], includeUnassignedAssets: boolean): AssetPermissionSearchResultSet!. See AssetPermissionsAssetType AssetPermissionInputEnum, and AssetPermissionSearchResultSet.
searchDomainCountintegeryes The number of search domains for the group.
searchDomainRoles(searchDomainId: string): [SearchDomainRole]yes The search domain roles assigned to the group (seeSearchDomainRole).
searchDomainRolesByName(searchDomainName: string): SearchDomainRoleyes The search domain roles assigned to the group, by name. The searchDomainName is a string value, not a complex datatype (see SearchDomainRole).
searchDomainRolesBySearchDomainNamestringyes The domain roles by search domain name. The datatype consists of (searchDomainName: string!): [SearchDomainRole!]. See SearchDomainRole.
searchUsersmultipleyes Used to search the list of users in the group. The datatype consists of (searchFilter: string, skip: integer, limit: integer, sortBy: OrderByUserField, orderBy: OrderBy): UserResultSetType!. See OrderByUserField, OrderBy, UserResultSetType.
systemRoles[GroupSystemRole]yes The system roles of the group (see GroupSystemRole Table).
userCountintegeryes The number of users that are part of the group.
users[User]yes The list of users in the group (see User Table).