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:
-
Periodically poll the Amazon Simple Queue Service (Amazon SQS) queue for
REPORT_PROCESSING_FINISHED
notification event which provides information when the report processing isCANCELLED
,DONE
orFATAL
. The notification event includes areportDocumentId
value if there is report data available. -
For each
reportDocumentId
that represents a report that you want to retrieve:-
Call the
getReportDocument
operation, passing thereportDocumentId
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.
-
Download the report.
-
Note
- The
getReportDocument
operation is considered a restricted operation only when a restricted report type is specified.- When calling the
createRestrictedDataToken
operation to get an RDT for thegetReportDocument
operation, the specified restricted resource can contain only a specific path, not a generic path.- When using RDT to access the
getReportDocument
operation, make sure your application has the correct right roles to access the report. Refer to Roles in the Selling Partner API for roles to reports mapping.
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
-
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 thereportDocumentId
, which can be used to download the report. -
For each
reportDocumentId
that represents a report that you want to retrieve, save thereportDocumentId
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.
Updated 2 days ago