Migrating from Reports to ReportStats
Differences between Report and ReportStat
Report and ReportStat mostly share the same fields. The main difference is that the Report type represents a single ReportType (e.g. Added) and ReportStat contains the data for all available ReportTypes (Basic, Added, Missing and Removed).
Because of that, all fields which access URL data or rely on ReportType accept an additional reportType
argument.
By default, those fields return the data for the Basic ReportType and the argument is required only if you need to
access non-Basic ReportType data.
The total number of URLs, available under the Report totalRows field, can be accessed on ReportStat using fields named after ReportType. For example, to get the equivalent of the URLs count in a Removed Report you would retrieve the removed field on ReportStat.
ReportStat provides streamlined and faster access to your data but does not have the same filtering and sorting capabilities as Report.
For detailed examples and side-by-side comparisons, see the sections below.
Examples
getReport vs getReportStat
A single ReportStat with URL data can be retrieved by crawl ID and ReportTemplate code. Same as getReport, getReportStat accepts an optional segmentId argument as part of the input.
- Query
- Variables
- Response
query GetReport($input: GetReportInputType!) {
getReport(input: $input) {
crawlId
reportTemplateCode
reportTypeCodeEnum
totalRows
crawlUrls {
nodes {
url
# ...other metrics
}
}
}
}
{
"input": {
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "all_pages",
"reportTypeCode": "Basic"
}
}
{
"data": {
"getReport": {
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "all_pages",
"reportTypeCodeEnum": "Basic",
"totalRows": 9581,
"crawlUrls": {
"nodes": [
{
"url": "https://www.lumar.io/ja/blog/"
// ...other metrics
}
// ...other nodes
]
}
}
}
}
- Query
- Variables
- Response
query GetReportStat($input: GetReportStatInput!) {
getReportStat(input: $input) {
crawlId
reportTemplateCode
basic
crawlUrls {
nodes {
url
# ...other metrics
}
}
}
}
{
"input": {
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "all_pages"
}
}
{
"data": {
"getReportStat": {
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "all_pages",
"basic": 9581,
"crawlUrls": {
"nodes": [
{
"url": "https://www.lumar.io/"
// ...other metrics
}
// ...other nodes
]
}
}
}
}
getReportsForCrawls vs getReportStats
A multiple ReportStats can be retrieved by crawl ID and ReportTemplate code pairs. Additionally, an optional segmentId
argument can be provided as part of each input object.
- Query
- Variables
- Response
query GetReportsForCrawls(
$crawlIds: [ObjectID!]!
$filter: ReportConnectionFilterInput
) {
getReportsForCrawls(crawlIds: $crawlIds, filter: $filter) {
nodes {
crawlId
reportTemplateCode
reportTypeCodeEnum
totalRows
}
}
}
{
"crawlIds": ["TjAwNUNyYXdsMTc5MTU0Ng"],
"filter": {
"reportTemplateCode": {
"in": ["non-200_pages", "4xx_errors"]
},
"reportTypeCodeEnum": {
"eq": "Added"
}
}
}
{
"data": {
"getReportsForCrawls": {
"nodes": [
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "non-200_pages",
"reportTypeCodeEnum": "Added",
"totalRows": 36
},
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "4xx_errors",
"reportTypeCodeEnum": "Added",
"totalRows": 17
}
]
}
}
}
- Query
- Variables
- Response
query GetReportStats($inputs: [GetReportStatInput!]!) {
getReportStats(inputs: $inputs) {
crawlId
reportTemplateCode
added
}
}
{
"inputs": [
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "non-200_pages"
},
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "4xx_errors"
}
]
}
{
"data": {
"getReportStats": [
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "non-200_pages",
"added": 36
},
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "4xx_errors",
"added": 17
}
]
}
}
Crawl.reportsByCode vs Crawl.reportStats
By default, Crawl.reportStats field returns all available ReportStats. They can be filtered by providing an optional
reportTemplateCodes
argument. Same as the top-level queries from previous examples, an optional segmentId
argument
is also accepted.
- Query
- Variables
- Response
query GetCrawlReportsByCode(
$crawlId: ObjectID!
$input: CrawlReportsByCodeInput!
) {
getCrawl(id: $crawlId) {
reportsByCode(input: $input) {
crawlId
reportTemplateCode
totalRows
}
}
}
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"input": {
"reportTemplateCodes": ["non-200_pages", "4xx_errors"]
}
}
{
"data": {
"getCrawl": {
"reportsByCode": [
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "non-200_pages",
"totalRows": 2069
},
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "4xx_errors",
"totalRows": 1420
}
]
}
}
}
- Query
- Variables
- Response
query GetCrawlReportStats(
$crawlId: ObjectID!
$reportTemplateCodes: [String!]
) {
getCrawl(id: $crawlId) {
reportStats(reportTemplateCodes: $reportTemplateCodes) {
crawlId
reportTemplateCode
basic
}
}
}
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCodes": ["non-200_pages", "4xx_errors"]
}
{
"data": {
"getCrawl": {
"reportStats": [
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "non-200_pages",
"basic": 2069
},
{
"crawlId": "TjAwNUNyYXdsMTc5MTU0Ng",
"reportTemplateCode": "4xx_errors",
"basic": 1420
}
]
}
}
}
Crawl.reports vs Crawl.reportStats
Crawl.reportStats field does not provide the same filtering capabilities as Crawl.reports field. It can only be
filtered by providing an optional reportTemplateCodes
argument as shown in the previous example. It also doesn't have
any sorting capabilities. If required, additional filtering or sorting would have to be done on the client side after
retrieving all ReportStats.