How to Get ReportStats
ReportStats
are aggregations of report template filters on top of raw crawl data. For instance, the "Broken Pages" report template contains a filter similar to "httpStatusCode=404", and when a crawl finishes Lumar will generate the "Broken Pages" report with the basic
value being the number of URLs that were broken (matched the report template filter).
The getReportStats
query is the primary way to retrieve the high level ReportStat aggregations, and can also be used to get the actual URLs that are part of the report (see Get URL Data)
The following query will show you how to retrieve report data from the Lumar API.
Note: as with the getCrawls guide you will need to provide the Crawl ID for the id
parameter.
Use the getReportStats
query to retrieve high-level report data for selected ReportTemplates
The sample query below will return 3 properties (reportTemplate.name
, reportTemplate.code
, basic
) for all report templates.
For the comprehensive list, inspect type ReportStat
.
- Query
- Variables
- Response
- cURL
query GetReportStats($crawlId: ObjectID!) {
getReportStats(
inputs: [
{ crawlId: $crawlId, reportTemplateCode: "200_pages" }
{ crawlId: $crawlId, reportTemplateCode: "301_redirects" }
]
) {
reportTemplateName
reportTemplateCode
basic
}
}
{
"$crawlId": "TjAwNUNyYXdsMTc5MDQ3NQ"
}
{
"data": {
"getReportStats": [
{
"reportTemplateName": "200 Pages",
"reportTemplateCode": "200_pages",
"basic": 1679
},
{
"reportTemplateName": "301 Redirects",
"reportTemplateCode": "301_redirects",
"basic": 40
}
]
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"query GetReportStats($crawlId: ObjectID!) { getReportStats( inputs: [ { crawlId: $crawlId, reportTemplateCode: \"200_pages\" } { crawlId: $crawlId, reportTemplateCode: \"301_redirects\" } ] ) { reportTemplateName reportTemplateCode basic } }","variables":{"$crawlId":"TjAwNUNyYXdsMTc5MDQ3NQ"}}' https://api.lumar.io/graphql
Use the getCrawl
query to retrieve high-level report data for all report templates
The sample query below will return 3 properties (reportTemplate.name
, reportTemplate.code
, basic
) for all report templates.
For the comprehensive list, inspect type ReportStat
.
- Query
- Variables
- Response
- cURL
query GetCrawlReportStats($crawlId: ObjectID!) {
getCrawl(id: $crawlId) {
reportStats {
reportTemplateName
basic
}
}
}
{
"id": "TjAwNUNyYXdsMTc5MDQ3NQ"
}
{
"data": {
"getCrawl": {
"reportStats": [
{
"reportTemplateName": "200 Pages",
"reportTemplateCode": "200_pages",
"basic": 1679
},
{
"reportTemplateName": "301 Redirects",
"reportTemplateCode": "301_redirects",
"basic": 40
},
// ...
{
"reportTemplateName": "Web Crawl Depth",
"reportTemplateCode": "web_crawl_depth",
"basic": 8
},
{
"reportTemplateName": "XML Sitemaps",
"reportTemplateCode": "xml_sitemaps",
"basic": 0
}
]
}
}
}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"query GetCrawlReportStats($crawlId: ObjectID!) { getCrawl(id: $crawlId) { reportStats { reportTemplateName basic } } }","variables":{"id":"TjAwNUNyYXdsMTc5MDQ3NQ"}}' https://api.lumar.io/graphql