Summary

A repository stores ingested data, configures parsers and data retention policies. The repository() GraphQL query returns information about a given repository.

Syntax

graphql
repository(
      name: String!, includeHidden: Boolean
   ): Repository!

Provide name (required) โ€” the repository name. Select Show Repositories Query below for an example of how to list repository names. Set includeHidden to include hidden repositories. See the Input Parameters section for details.

Returns a non-nullable Repository object. See the Returned Values section for available fields.

Hide Query Example

Show Repositories Query

Example

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


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": {
    "repository": {
      "id": "abc123",
      "name": "humio",
      "dashboards": [
        {
          "id": "def456",
          "name": "Parsers",
          "displayName": "Parsers"
        },
        {
          "id": "ghi789",
          "name": "Request-Response",
          "displayName": "Request-Response"
        },
    ...
    }
  }
}

Input Parameters

Provide name (required) โ€” the repository name. Set includeHidden to true to include a repository even if it is hidden in the UI.

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this query.
name String! yes ย  The name of the repository to query.
includeHidden Boolean ย  true Whether to include a repository in the results even if it is hidden in the UI.

Returned Values

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