Reports
- class sp_api.api.Reports(marketplace: sp_api.base.marketplaces.Marketplaces = Marketplaces.US, *, refresh_token=None, account='default', credentials=None, restricted_data_token=None)
Deprecated! Use ReportsV2 instead!
- create_report(self, **kwargs) ApiResponse
See report types at :link: https://github.com/amzn/selling-partner-api-docs/blob/main/references/reports-api/reportType_string_array_values.md
Usage Plan:
Rate (requests per second)
Burst
0.0167
15
- Parameters
reportOptions (key) – optional Additional information passed to reports. This varies by report type. ReportOptions
reportType (key) – required The report type. :link: https://github.com/amzn/selling-partner-api-docs/blob/main/references/reports-api/reportType_string_array_values.md
dataStartTime (key) – optional The start of a date and time range, in ISO 8601 date time format, used for selecting the data to report. The default is now. The value must be prior to or equal to the current date and time. Not all report types make use of this. string (date-time)
dataEndTime (key) – optional The end of a date and time range, in ISO 8601 date time format, used for selecting the data to report. The default is now. The value must be prior to or equal to the current date and time. Not all report types make use of this. string (date-time)
marketplaceIds (key) – optional, defaults to the client’s marketplace A list of marketplace identifiers. The report document’s contents will contain data for all of the specified marketplaces, unless the report type indicates otherwise. < string > array
- Returns
ApiResponse
- get_report(self, report_id, **kwargs)
Returns report details (including the reportDocumentId, if available) for the report that you specify.
Usage Plan:
Rate (requests per second)
Burst
2
15
For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.
- Parameters
report_id – str
- Returns
ApiResponse
- get_report_document(self, document_id, decrypt: bool = False, file=None, character_code: str = 'iso-8859-1', **kwargs) ApiResponse
Returns the information required for retrieving a report document’s contents. This includes a presigned URL for the report document as well as the information required to decrypt the document’s contents.
If decrypt = True the report will automatically be loaded and decrypted/unpacked If file is set to a file (or file like object), the report’s contents are written to the file
Usage Plan:
Rate (requests per second)
Burst
0.0167
15
For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.
- Parameters
document_id – str | the document to load
decrypt – bool | flag to automatically decrypt a report
file – If passed, will save the document to the file specified. Only valid if decrypt=True
character_code – If passed, will be a file with the specified character code. The default is ‘iso-8859-1’. Only valid if decrypt=True
- Returns
ApiResponse
- create_report_schedule(self, **kwargs) ApiResponse
Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it will be cancelled and replaced with this one.
Usage Plan:
Rate (requests per second)
Burst
0.0222
10
For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.
- Parameters
kwargs –
- Returns
- delete_report_schedule(self, schedule_id, **kwargs) ApiResponse
Cancels the report schedule that you specify.
Usage Plan:
Rate (requests per second)
Burst
0.0222
10
For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.
- Parameters
schedule_id – str
kwargs –
- Returns
ApiResponse
- get_report_schedule(**kwargs)
Returns report schedule details for the report schedule that you specify.
Usage Plan:
Rate (requests per second)
Burst
0.0222
10
For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.
- Parameters
schedule_id – str | required The identifier for the report schedule. This identifier is unique only in combination with a seller ID.
kwargs –
- Returns
ApiResponse
- get_report_schedules(**kwargs)
Returns report schedule details that match the filters that you specify.
Usage Plan:
Rate (requests per second)
Burst
0.0222
10
For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.
- Parameters
reportTypes (key) – str[] or ReportType[] | required A list of report types used to filter report schedules. Min count : 1. Max count : 10.
- Returns
ApiResponse
- get_reports(self, **kwargs) ApiResponse
Returns report details for the reports that match the filters that you specify.
Usage Plan:
Rate (requests per second)
Burst
0.0222
10
For more information, see “Usage Plans and Rate Limits” in the Selling Partner API documentation.
- Parameters
reportTypes (key) – str[] or ReportType[] | optional A list of report types used to filter reports. When reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required.
processingStatuses (key) – str[] or ProcessingStatus[] optional A list of processing statuses used to filter reports.
marketplaceIds (key) – str[] or Marketplaces[] optional A list of marketplace identifiers used to filter reports. The reports returned will match at least one of the marketplaces that you specify.
pageSize (key) – int optional The maximum number of reports to return in a single call.
createdSince (key) – str or datetime optional The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days. string (date-time) -
createdUntil (key) – str or datetime optional The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now. string (date-time) -
nextToken (key) – str optional A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. string -
- Returns
ApiResponse
- static decrypt_report_document(url, initialization_vector, key, encryption_standard, character_code, payload)
Decrypts and unpacks a report document, currently AES encryption is implemented