Retrieve automatically generated reports

Learn how to use the Reports API to retrieve automatically generated reports.

Learn how to use the Reports API to retrieve automatically generated reports. Use the following process for requesting an automatically generated report:

  1. Periodically poll the Amazon Simple Queue Service (Amazon SQS) queue for REPORT_PROCESSING_FINISHED notification event which provides information when the report processing is CANCELLED, DONE or FATAL. The notification event includes a reportDocumentId value if there is report data available.

  2. For each reportDocumentId that represents a report that you want to retrieve:

    1. Call the getReportDocument operation, passing the reportDocumentId value.

      Amazon returns a pre-signed URL for the location of the report document, and the compression algorithm used if the report document contents have been compressed.

    2. Download the report.

Prerequisites

To complete these tutorials, you need:

  • Authorization from the selling partner for whom you are making calls. For more information, refer to Authorizing Selling Partner API applications.
  • One of the required roles for the Reports API assigned to your developer profile.
  • One of the required roles for the Reports API selected in the app registration page for your application.
  • The report type that you will request. Refer to Report Type Values for a list of the available report types.
  • A working Java Development Kit (JDK) installation to run sample code.

Step 1. Retrieve information about reports that can be downloaded

  1. You can periodically poll the Amazon SQS queue to check if you have received a notification regarding the Amazon generated reports. To confirm that report processing is complete, refer to Verify that the report processing is complete.

    The REPORT_PROCESSING_FINISHED notification event contains the reportDocumentId, which can be used to download the report.

  2. For each reportDocumentId that represents a report that you want to retrieve, save the reportDocumentId and go to Step 2 to retrieve the report.

The following response example contains the reportDocumentId that you need to retrieve the report.

{
  "reports": [
    {
      "reportType": "GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE",
      "processingEndTime": "2021-08-03T01:02:25+00:00",
      "processingStatus": "DONE",
      "marketplaceIds": [
        "ATVPDKIKX0DER"
      ],
      "reportDocumentId": "DOC-b8b0-4226-b4b9-0ee058ea5760",
      "reportId": "ID222",
      "dataEndTime": "2021-08-03T01:02:25+00:00",
      "createdTime": "2021-08-03T01:02:25+00:00",
      "processingStartTime": "2021-08-03T01:02:25+00:00",
      "dataStartTime": "2021-08-03T01:02:25+00:00"
    }
  ]
}

Step 2. Retrieve the report

To retrieve a report, refer to Retrieve a report.