Summary

The childOrganizations() GraphQL query returns a paginated list of child organizations linked to the current organization. This query applies to multi-organization environments only; it is not supported in single-organization mode.

Syntax

graphql
childOrganizations(
      search: String,
      skip: Int! = 0,
      limit: Int! = 50,
      orderBy: OrderBy = ASC,
      sortBy: OrganizationsLinks__SortBy = Name
   ): ChildOrganizationsResultSet!

skip and limit default to 0 and 50, so pagination works without explicit input. Use search to filter by organization name; sortBy and orderBy control sort order. See Input Parameters for details.

Example

Raw
graphql
query {
	childOrganizations( skip: 0, limit: 10 )
  { totalResults, 
    results { id, name, 
              searchDomains { id },
              stats { 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 {
	childOrganizations( skip: 0, limit: 10 )
  { totalResults, 
    results { id, name, 
              searchDomains { id },
              stats { 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 {
	childOrganizations( skip: 0, limit: 10 )
  { totalResults, 
    results { id, name, 
              searchDomains { id },
              stats { 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 { ^
	childOrganizations( skip: 0, limit: 10 ) ^
  { totalResults,  ^
    results { id, name,  ^
              searchDomains { id }, ^
              stats { userCount } } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
	childOrganizations( skip: 0, limit: 10 )
  { totalResults, 
    results { id, name, 
              searchDomains { id },
              stats { 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 {
	childOrganizations( skip: 0, limit: 10 )
  { totalResults, 
    results { id, name, 
              searchDomains { id },
              stats { 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 {
	childOrganizations( skip: 0, limit: 10 )
  { totalResults, 
    results { id, name, 
              searchDomains { id },
              stats { 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 {
	childOrganizations( skip: 0, limit: 10 )
  { totalResults, 
    results { id, name, 
              searchDomains { id },
              stats { 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": {
    "childOrganizations": {
      "totalResults": 1,
      "results": {
         "id": "abc123",
         "name": "junior",
         "searchDomains": { "id": "xyz789" }
         "stats": { userCount: 12 }
      }
    }
  }
}

Input Parameters

skip and limit default to 0 and 50 respectively, so they do not need to be supplied unless you want non-default pagination. Provide search to filter results by organization name. Use sortBy and orderBy to control the sort order. The parameters are listed here:

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.
limit Int   50 The maximum number of results to return.
orderBy OrderBy   ASC The order in which the results are returned. See table below.
search String     Text by which to search organization name.
skip Int   0 Number of results to skip.
sortBy OrganizationsLinks__SortBy   Name Basis for sorting organizational links. See table below.

As mentioned above, you can sort results based on the type of organization link. The table below provides an enumerated list of choices:

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

Returned Values

The result contains totalResults (the total count of matching organizations) and results (the paginated list of Organization objects). Use totalResults together with skip and limit to implement full pagination. The available fields are listed here:

Table: ChildOrganizationsResultSet Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
resultsOrganizationyes Short-Term The paginated result set. See Organization.
totalResultsIntyes Short-Term The total number of matching results.

The ChildOrganizationsResultSet type contains Organization objects. For reference, the Organization datatype table is included here:

Table: Organization Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
actionOrganizationAction):Booleanyes Short-Term The action to check if a user is allowed to perform on an organization.
cidString  Short-Term The CID corresponding to the organization.
configsOrganizationConfigsyes Short-Term Organization configurations and settings. See OrganizationDetails.
createdAtLong  Short-Term Date organization was created.
defaultCachePolicyCachePolicy  Short-Term The default cache policy of the organization. See CachePolicy. This is a preview and subject to change.
deletedAtLong  Short-Term Day organization was deleted if it was marked for deletion.
descriptionString  Short-Term The description for the Organization. Can be null.
detailsOrganizationDetailsyes Short-Term Any additional details related to the organization. See OrganizationDetails.
externalGroupSynchronizationBooleanyes Short-Term Whether there is group synchronization.
externalPermissionsBooleanyes Short-Term Whether permissions are managed externally.
idStringyes Short-Term The unique id for the Organization.
ingestUrlString  Short-Term The ingest URL for the organization.
limitsLimityes Short-Term Limits assigned to the organization. See Limit.
limitsV2LimitV2yes Short-Term Limits assigned to the organization. See LimitV2.
nameStringyes Short-Term The name for the Organization.
publicUrlString  Short-Term The public URL for the organization.
readonlyDashboardIPFilterString  Short-Term IP filter for readonly dashboard links.
searchDomainsSearchDomainyes Short-Term Search domains within the organization. See SearchDomain.
statsOrganizationStatsyes Short-Term Statistics of the organization. See OrganizationStats.
trialStartedAtLong  Short-Term Date organization's trial started.