startReportTask

Version 2024-11-01

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

Overview

Start report task

Response

Return type StartReportTaskResponse

Arguments

ArgumentDescription
input (StartReportTaskInput required)

Specifies the input fields to start a report task.

Examples


Start Report Task

Request

mutation StartReportTask {
  startReportTask(
    input: {
      timeRange: {
        startDate: "2023-06-01T20:58:49Z"
        endDate: "2024-06-03T20:58:49Z"
      }
      reportType: "USER_EVENTS"
    }
  ) {
    taskId
  }
}

Response

{
  "data": {
    "startReportTask": {
      "taskId": "USER_EVENTS:23272b65-efac-412d-a8aa-ce8ef41bb448"
    }
  }
}

Report Type Validation Error

Request

mutation StartReportTask {
  startReportTask(
    input: {
      timeRange: {
        startDate: "2025-06-01T20:58:49Z"
        endDate: "2024-06-03T20:58:49Z"
      }
      reportType: "INVALID_REPORT_TYPE"
    }
  ) {
    taskId
  }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: [Invalid report type (any value other than predefined report types)]",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": ["startReportTask"],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "InvalidReportType",
          "details": {
            "message": "Invalid report type (any value other than predefined report types)"
          },
          "errorType": "ValidationException",
          "errorCode": 400
        }
      }
    }
  ],
  "data": {
    "startReportTask": null
  }
}

Date Range Validation Error

Request

mutation StartReportTask {
  startReportTask(
    input: {
      timeRange: {
        startDate: "2025-06-01T20:58:49Z"
        endDate: "2024-06-03T20:58:49Z"
      }
      reportType: "USER_EVENTS"
    }
  ) {
    taskId
  }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: [Invalid date range (eg. future date provided)]",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": ["startReportTask"],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "InvalidDateRange",
          "details": {
            "message": "Invalid date range (eg. future date provided)"
          },
          "errorType": "ValidationException",
          "errorCode": 400
        }
      }
    }
  ],
  "data": {
    "startReportTask": null
  }
}

Date Format Validation Error

Request

mutation StartReportTask {
  startReportTask(
    input: {
      timeRange: { startDate: "06/01/2024", endDate: "06/03/2024" }
      reportType: "USER_EVENTS"
    }
  ) {
    taskId
  }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: [Invalid date format (non ISO 8601 UTC format)]",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": ["startReportTask"],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "InvalidDateFormat",
          "details": {
            "message": "Invalid date format (non ISO 8601 UTC format)"
          },
          "errorType": "ValidationException",
          "errorCode": 400
        }
      }
    }
  ],
  "data": {
    "startReportTask": null
  }
}