The dashboardsPage() GraphQL query is used to retrieve a dashboard. This field is not yet available. It's described here as a preview and is used for getting a new pagination pattern.

For more information on dashboards, see the Dashboards & Widgets documentation page. You may also want to look at the Dashboards page in the Training section.

Syntax

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

graphql
dashboardsPage(
   search: string
   pageNumber: integer!
   pageSize: integer!
): DashboardPage!

For the input in the syntax here, the search is optional. It searches only the names of dashboards. If you don't include it, all dashboards are returned. For the pageSize you'd specify the number of records you want per page. Imagining a list of dashboards that span several pages, use pageNumber to specify which page to return.

Raw
graphql
query{
  dashboardsPage(
    search: "hosts"
    pageSize: 10
    pageNumber: 1
  ) {
    page {
      id, name, 
      displayName, searchDomain {
        id, name
      }
    }
    pageInfo {
      number
      totalNumberOfRows
      total
    }
  }
}
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{
  dashboardsPage(
    search: \"hosts\"
    pageSize: 10
    pageNumber: 1
  ) {
    page {
      id, name, 
      displayName, searchDomain {
        id, name
      }
    }
    pageInfo {
      number
      totalNumberOfRows
      total
    }
  }
}"
}
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{
  dashboardsPage(
    search: \"hosts\"
    pageSize: 10
    pageNumber: 1
  ) {
    page {
      id, name, 
      displayName, searchDomain {
        id, name
      }
    }
    pageInfo {
      number
      totalNumberOfRows
      total
    }
  }
}"
}
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{ ^
  dashboardsPage( ^
    search: \"hosts\" ^
    pageSize: 10 ^
    pageNumber: 1 ^
  ) { ^
    page { ^
      id, name,  ^
      displayName, searchDomain { ^
        id, name ^
      } ^
    } ^
    pageInfo { ^
      number ^
      totalNumberOfRows ^
      total ^
    } ^
  } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query{
  dashboardsPage(
    search: \"hosts\"
    pageSize: 10
    pageNumber: 1
  ) {
    page {
      id, name, 
      displayName, searchDomain {
        id, name
      }
    }
    pageInfo {
      number
      totalNumberOfRows
      total
    }
  }
}"
}'
"$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $json = '{"query" : "query{
  dashboardsPage(
    search: \"hosts\"
    pageSize: 10
    pageNumber: 1
  ) {
    page {
      id, name, 
      displayName, searchDomain {
        id, name
      }
    }
    pageInfo {
      number
      totalNumberOfRows
      total
    }
  }
}"
}';
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{
  dashboardsPage(
    search: \"hosts\"
    pageSize: 10
    pageNumber: 1
  ) {
    page {
      id, name, 
      displayName, searchDomain {
        id, name
      }
    }
    pageInfo {
      number
      totalNumberOfRows
      total
    }
  }
}"
}'''

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{
  dashboardsPage(
    search: \"hosts\"
    pageSize: 10
    pageNumber: 1
  ) {
    page {
      id, name, 
      displayName, searchDomain {
        id, name
      }
    }
    pageInfo {
      number
      totalNumberOfRows
      total
    }
  }
}"
}
);


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": {
    "dashboardsPage": {
      "page": [
        {
          "id": "VE3V5Y9pvz3fh7dlXiEuYQqwkV7dnonk",
          "name": "Hosts",
          "displayName": "Hosts",
          "searchDomain": {
            "id": "E2r1cF9ffkIR37KowkxUQxQS",
            "name": "humio"
          }
        }
      ],
      "pageInfo": {
        "number": 1,
        "totalNumberOfRows": 1,
        "total": 1
      }
    }
  }
}

Notice that the example above requests information on dashboards with the name hosts. That resulted in one dashboard with that text in the name. The results show the unique identifiers, the name of the dashboard, and the repository, as requested. Click on Dashboard datatype in the table below for more parameters.

Returned Datatypes

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

Table: DashboardPage

ParameterTypeRequired[a]DefaultDescription
pageInfoPageTypeyes Information about the dashboards page (see PageType Table).
page[Dashboard]yes The dashboards to be used for the dashboard page (see Dashboard Table).

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.