How to Get Reports
Reports
are deprecated, please refer to ReportStats
'Reports' 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 totalRows
value being the number of URLs that were broken (matched the report template filter).
The Report query is the primary way to retrieve the high level Report 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 getCrawl
query to retrieve high-level report data
The sample query below will return 3 properties (reportTemplate.name
, reportTemplate.code
, totalRows
) - for the comprehensive list, inspect type Report
.
- Query
- Variables
- Response
- cURL
query getCrawl($id: ObjectID!) {
getCrawl(id: $id) {
reports(
first: 2
filter: {
datasourceCode: { eq: "crawl_urls" }
reportTypeCode: { eq: "basic" }
segmentId: { isNull: true }
}
orderBy: { field: reportTemplateCode, direction: ASC }
) {
nodes {
reportTemplate {
name
code
}
totalRows
}
}
}
}
{
"id": 1583246
}
{
"data": {
"getCrawl": {
"reports": {
"nodes": [
{
"reportTemplate": {
"name": "200 Pages",
"code": "200_pages"
},
"totalRows": 467
},
{
"reportTemplate": {
"name": "301 Redirects",
"code": "301_redirects"
},
"totalRows": 19
}
]
}
}
}
}
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 getCrawl($id: ObjectID!) { getCrawl(id: $id) { reports( first: 2 filter: { datasourceCode: { eq: \"crawl_urls\" } reportTypeCode: { eq: \"basic\" } segmentId: { isNull: true } } orderBy: { field: reportTemplateCode, direction: ASC } ) { nodes { reportTemplate { name code } totalRows } } } }","variables":{"id":1583246}}' https://api.lumar.io/graphql