Summary

The searchOrganizations() GraphQL query returns paginated search results of information about organizations. This is a root operation.

Syntax

graphql
searchOrganizations(
      searchFilter: String,
      sortBy: Organizations__SortBy!,
      typeFilter: [Organizations__SearchEntryType!],
      subscriptionFilter: [Organizations__Subscription!],
      includeDeletedFilter: Boolean,
      orderBy: OrderBy = ASC,
      skip: Int = 0,
      limit: Int = 50
   ): OrganizationSearchResultSet!

Provide any text on which to search for organizations, indicate whether to include deleted ones, possibly the type of search entity, the type of subscription, how to sort results, how to order results, and the number of results to skip and how many to return. See the Input Parameters section for details.

Returns a non-nullable OrganizationSearchResultSet object. See the Returned Values section.

Example

Raw
graphql
query {
  searchOrganizations(
    typeFilter: Organization
    subscriptionFilter: Paying
    sortBy: Name
    orderBy: ASC
  )
   {totalResults, 
    results {organizationId, organizationName, userCount}}
}
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 {
  searchOrganizations(
    typeFilter: Organization
    subscriptionFilter: Paying
    sortBy: Name
    orderBy: ASC
  )
   {totalResults, 
    results {organizationId, organizationName, userCount}}
}"
}
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 {
  searchOrganizations(
    typeFilter: Organization
    subscriptionFilter: Paying
    sortBy: Name
    orderBy: ASC
  )
   {totalResults, 
    results {organizationId, organizationName, userCount}}
}"
}
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 { ^
  searchOrganizations( ^
    typeFilter: Organization ^
    subscriptionFilter: Paying ^
    sortBy: Name ^
    orderBy: ASC ^
  ) ^
   {totalResults,  ^
    results {organizationId, organizationName, userCount}} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
  searchOrganizations(
    typeFilter: Organization
    subscriptionFilter: Paying
    sortBy: Name
    orderBy: ASC
  )
   {totalResults, 
    results {organizationId, organizationName, userCount}}
}"
}'
    "$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 {
  searchOrganizations(
    typeFilter: Organization
    subscriptionFilter: Paying
    sortBy: Name
    orderBy: ASC
  )
   {totalResults, 
    results {organizationId, organizationName, userCount}}
}";
$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 {
  searchOrganizations(
    typeFilter: Organization
    subscriptionFilter: Paying
    sortBy: Name
    orderBy: ASC
  )
   {totalResults, 
    results {organizationId, organizationName, userCount}}
}"
}'''

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 {
  searchOrganizations(
    typeFilter: Organization
    subscriptionFilter: Paying
    sortBy: Name
    orderBy: ASC
  )
   {totalResults, 
    results {organizationId, organizationName, userCount}}
}"
}
);


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": {
    "searchOrganizations": {
      "totalResults": 1,
      "results": [
        {
          "organizationId": "SINGLE_ORGANIZATION_ID",
          "organizationName": "SingleOrganization",
          "userCount": 18
        }
      ]
    }
  }
}

Input Parameters

Provide any text on which to search for organizations, indicate whether to include deleted ones, possibly the type of search entity (see second table below), the type of subscription (see the third table), how to sort results (see fourth), how to order results (see fifth), and the number of results to skip and how many to return.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this query. Since some of the parameters use special datatypes, additional tables for them are included below.
includeDeletedFilter Boolean     Whether to include deleted organizations in results.
limit Int   50 The maximum number of results to return.
orderBy OrderBy   ASC How to order results. See table below.
searchFilter String     Any text on which to filter results.
skip Int   0 The number of results to skip, or offset to use.
sortBy Organizations__SortBy yes   How to sort results. See table below.
subscriptionFilter Organizations__Subscription     The type of LogScale subscription on which to filter results. See table below.
typeFilter Organizations__SearchEntryType     Type of search domain or entity on which to filter results. See table below.

This special datatype allows you to filter based on the type of search domain or entity.

Table: Organizations__SearchEntryType Enum Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
Organization      
Repository      
User      
View      

The second datatype allows you to filter based on the type of LogScale subscription (for example, Trial, Paying). There are many choices and they are listed in the table below:

Table: Organizations__Subscription Enum Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
Churned      
ClusterOwner      
CommunityLocked      
CommunityUnlocked      
Complementary      
Internal      
MissingTOSAcceptance      
OnPremMonitor      
Partner      
Paying      
PostTrial      
PreTrial      
Trial      
Unknown      
UnlimitedPoC      

The next datatype allows you to sort the results based other factors, such as the number of users in each organization, when each organization was created. The choices for this are listed in the table below:

Table: Organizations__SortBy Enum Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
CreatedAt      
Name      
Subscription      
UserCount      
ViewCount      
Volume      

The other input datatype is a simple one. You can return results based on whether they are in ascending or descending order, alphanumerically.

Returned

Returns a non-nullable OrganizationSearchResultSet object. The table below lists all fields:

Table: OrganizationSearchResultSet Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
resultsOrganizationSearchResultEntryyes Short-Term The paginated result set
totalResultsIntyes Short-Term The total number of matching results

The OrganizationSearchResultSet type contains OrganizationSearchResultEntry objects. For reference, the OrganizationSearchResultEntry datatype table is included here:

Table: OrganizationSearchResultEntry Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
byteVolumeLongyes Short-Term The total data volume in bytes that the organization is currently using
createdAtLongyes Short-Term The time when the organization was created
deletedAtLong  Short-Term If the organization has been marked for deletion, this indicates the time when the organization was marked.
entityIdStringyes Short-Term The id of the entity matched
organizationOrganizationyes Short-Term The relevant organization for the result
organizationIdStringyes Short-Term The unique id for the Organization
organizationNameStringyes Short-Term The name of the Organization
searchMatchStringyes Short-Term The string matching the search
subscriptionOrganizations__Subscriptionyes Short-Term The subscription type of the organization
trialEndDateLong  Short-Term The end date of the trial if applicable
typeOrganizations__SearchEntryTypeyes Short-Term The type of the search result match
userCountIntyes Short-Term The amount of users in the organization
viewCountIntyes Short-Term The amount of repositories and views in the organization