Schedule and retrieve reports
Learn how to use the Reports API to schedule and retrieve reports.
Learn how to use the Reports API to schedule and retrieve reports. You can schedule requests for reports so that they are submitted periodically, using the createReportSchedule
operation. Use the period enumeration to specify the time period. To identify which reports can be scheduled, review the Report Type Values in the Selling Partner API documentation.
Use the following process to request a report:
-
Call the
createReportSchedule
operation to create a schedule for periodically submitting report requests. SpecifyreportType
,marketplaceIds
,period
values, and any optional parameters. ForreportType
values, refer to reportType values.Note
If a report schedule with the same report type and marketplace IDs already exists, it is cancelled and replaced with this schedule. Otherwise, a new report schedule is created.
-
Periodically poll the Amazon Simple Queue Service (Amazon SQS) queue for a
REPORT_PROCESSING_FINISHED
notification event using an interval that is similar to the schedule that you configured in the first step.If you receive a notification for the scheduled report, the notification event contains report information, including
reportDocumentId
value if report data is available. -
For each
reportDocumentId
:-
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.
-
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. Create a schedule for report requests
Call the createReportSchedule
operation to create a schedule for submitting report requests, specifying the reportType
, marketplaceIds
, and period
values and any optional parameters. Refer to reportType values for a list of the available report types.
Name | Description | Required |
---|---|---|
reportType | The report type. Type: string | Yes |
marketplaceIds | A list of marketplace identifiers for the report schedule. Type: < string > array | Yes |
reportOptions | Additional information passed to reports. This varies by report type. Type: ReportOptions | No |
period | One of a set of predefined ISO 8601 periods that specifies how often a report should be created. Type: enum ( Period ) | Yes |
nextReportCreationTime | The date and time when the schedule will create its next report, in ISO 8601 date-time format. Type: string (date-time) | No |
createReportSchedule
request example
createReportSchedule
request examplePOST https://sellingpartnerapi-na.amazon.com/reports/2021-06-30/schedules
{
"reportType": "GET_XML_BROWSE_TREE_DATA",
"period": "P2D",
"marketplaceIds":["ATVPDKIKX0DER"]
}
A successful response includes the following:
Name | Description | Schema |
---|---|---|
CreateReportScheduleResponse | The payload for the createReportSchedule operation. | CreateReportScheduleResponse |
createReportSchedule
response example
createReportSchedule
response example{
"reportScheduleId": "ID323"
}
Step 2. Periodically retrieve information about the scheduled reports
Periodically poll the Amazon SQS queue for REPORT_PROCESSING_FINISHED
notification event using an interval that is similar to the schedule that you configured in step 1. To confirm that report processing is complete, refer to the REPORT_PROCESSING_FINISHED
notification event.
Step 3. Retrieve the report
To retrieve a report, refer to Retrieve a report.
Updated about 18 hours ago