Summary

The repositories() GraphQL query returns a list of repositories and details about each, including users with access, triggers, and actions.

Syntax

graphql
repositories(
      includeSandboxes: Boolean,
      includeHidden: Boolean
   ): [Repository!]!

You may indicate whether to include sandboxes of other users, and whether to include hidden repositories in the results.

For LogScale cloud accounts, repositories are marked hidden when created for demonstration or tutorial data. They are only accessible internally. The includeHidden input parameter allows administrators to see these repositories that would otherwise be excluded from the results. None of this applies to self-hosted installations since repositories are not hidden for them. See the Input Parameters section for more.

Returns a non-nullable list of Repository objects. See the Returned Values section for available fields.

Example

Raw
graphql
query {
  repositories(includeHidden: true, includeSandboxes: false)
  {name, id, awsExternalId, type, dataType, dashboards {
    id, name, displayName
  }, timeOfLatestIngest}
}
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 {
  repositories(includeHidden: true, includeSandboxes: false)
  {name, id, awsExternalId, type, dataType, dashboards {
    id, name, displayName
  }, timeOfLatestIngest}
}"
}
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 {
  repositories(includeHidden: true, includeSandboxes: false)
  {name, id, awsExternalId, type, dataType, dashboards {
    id, name, displayName
  }, timeOfLatestIngest}
}"
}
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 { ^
  repositories(includeHidden: true, includeSandboxes: false) ^
  {name, id, awsExternalId, type, dataType, dashboards { ^
    id, name, displayName ^
  }, timeOfLatestIngest} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
  repositories(includeHidden: true, includeSandboxes: false)
  {name, id, awsExternalId, type, dataType, dashboards {
    id, name, displayName
  }, timeOfLatestIngest}
}"
}'
    "$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 {
  repositories(includeHidden: true, includeSandboxes: false)
  {name, id, awsExternalId, type, dataType, dashboards {
    id, name, displayName
  }, timeOfLatestIngest}
}";
$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 {
  repositories(includeHidden: true, includeSandboxes: false)
  {name, id, awsExternalId, type, dataType, dashboards {
    id, name, displayName
  }, timeOfLatestIngest}
}"
}'''

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 {
  repositories(includeHidden: true, includeSandboxes: false)
  {name, id, awsExternalId, type, dataType, dashboards {
    id, name, displayName
  }, timeOfLatestIngest}
}"
}
);


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": {
    "repositories": [
      {
        "timeOfLatestIngest": "2024-10-30T12:09:49.909Z",
        "id": "abc123",
        "awsExternalId": "SINGLE_ORGANIZATION_ID/aK9GKAsTnMXfRxT8Fpecx3fX",
        "name": "humio",
        "dashboards": [
          {
            "id": "def456",
            "name": "Parsers",
            "displayName": "Parsers"
          },
          {
            "id": "ghi789",
            "name": "Overview",
            "displayName": "Overview"
          },
          {
            "id": "sVDzR6aL93MFnVtzyNJZmFR2vnqlnLgj",
            "name": "Request-Response",
            "displayName": "Request-Response"
          },
          {
            "id": "G7nWm1GJ2NG8oGv5K0eCxaAtYG6gsr3x",
            "name": "Ingest",
            "displayName": "Ingest"
          },
        ... 
        ],
        "dataType": "ANYDATA",
        "type": "SYSTEM"
      },
      ... 
      {
        "timeOfLatestIngest": "2024-10-30T12:09:16.569Z",
        "id": "N7t1bAn6xWMsWjVptueeNR16",
        "awsExternalId": "SINGLE_ORGANIZATION_ID/N7t1bAn6xWMsWjVptueeNR16",
        "name": "humio-metrics",
        "dashboards": [],
        "dataType": "ANYDATA",
        "type": "SYSTEM"
      },
    ... 
    ]
  }
}

In this example, the results shown have been truncated to save space.

Input Parameters

Use includeSandboxes to include sandboxes of other users, and includeHidden to include hidden repositories in the results.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this query.
includeSandboxes Boolean ย  true Whether to include sandboxes of other users in the results.
includeHidden Boolean ย  true Whether to include hidden repositories in the results.

Returned Values

Returns a non-nullable list of Repository objects. The table below lists all fields: