Feeds๏
- class sp_api.api.Feeds(marketplace: ~sp_api.base.marketplaces.Marketplaces = Marketplaces.US, *, refresh_token=None, account='default', credentials=None, restricted_data_token=None, proxies=None, verify=True, timeout=None, version=None, credential_providers=None, auth_token_client_class=<class 'sp_api.auth.access_token_client.AccessTokenClient'>)๏
Feeds SP-API Client :link:
The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
- get_feeds(self, **kwargs) ApiResponse ๏
Returns feed details for the feeds that match the filters that you specify.
- Parameters:
feedTypes (key) โ array | A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required.
marketplaceIds (key) โ array | A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify.
pageSize (key) โ integer | The maximum number of feeds to return in a single call.
processingStatuses (key) โ array | A list of processing statuses used to filter feeds.
createdSince (key) โ string | The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days.
createdUntil (key) โ string | The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now.
nextToken (key) โ string | 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 getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail.
- Return type:
- submit_feed(self, feed_type: str, file: File or File like, content_type='text/tsv', **kwargs) [ApiResponse, ApiResponse] ๏
Combines create_feed_document and create_feed, uploads the file and sends the feed to amazon.
Usage Plan:
Rate (requests per second)
Burst
0.0083
15
Examples
literal blocks:
feed = BytesIO feed.write(<your feed>) feed.seek(0) Feeds().submit_feed('POST_FBA_INBOUND_CARTON_CONTENTS', feed, 'text/xml')
- Parameters:
feed_type
file
content_type
**kwargs
- Returns:
, ApiResponse:]
- Return type:
- create_feed(self, feed_type: str, input_feed_document_id: str, **kwargs) ApiResponse ๏
Creates a feed. Call create_feed_document to upload the feed first. submit_feed combines both.
Usage Plan:
Rate (requests per second)
Burst
0.0083
15
For more information, see โUsage Plans and Rate Limitsโ in the Selling Partner API documentation.
Examples
literal blocks:
Feeds().create_feed('POST_PRODUCT_DATA', '3d4e42b5-1d6e-44e8-a89c-2abfca0625bb', marketplaceIds=["ATVPDKIKX0DER", "A1F83G8C2ARO7P"])
- Parameters:
feed_type โ https://github.com/amzn/selling-partner-api-docs/blob/main/references/feeds-api/feedtype-values.md
input_feed_document_id โ str
**kwargs
- Return type:
- cancel_feed(self, feedId, **kwargs) ApiResponse ๏
Cancels the feed that you specify. Only feeds with processingStatus=IN_QUEUE can be cancelled. Cancelled feeds are returned in subsequent calls to the getFeed and getFeeds operations.
- Parameters:
feedId โ string | * REQUIRED The identifier for the feed. This identifier is unique only in combination with a seller ID.
- Return type:
- get_feed(self, feedId, **kwargs) ApiResponse ๏
Returns feed details (including the resultDocumentId, if available) for the feed that you specify.
- Parameters:
feedId โ string | * REQUIRED The identifier for the feed. This identifier is unique only in combination with a seller ID.
- Return type:
- create_feed_document(self, **kwargs) ApiResponse ๏
Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a feedDocumentId value that you can pass in with a subsequent call to the createFeed operation.
For more information, see โUsage Plans and Rate Limitsโ in the Selling Partner API documentation.
- Parameters:
file โ File or File like object. Setting this to None will skip the upload.
content_type โ str
body โ
* REQUIRED {โdescriptionโ: โSpecifies the content type for the createFeedDocument operation.โ, โpropertiesโ: {โcontentTypeโ: {โdescriptionโ: โThe content type of the feed.โ, โtypeโ: โstringโ}}, โrequiredโ: [โcontentTypeโ], โtypeโ: โobjectโ}
- Return type:
- get_feed_document(self, feedDocumentId, **kwargs) ApiResponse ๏
Returns the information required for retrieving a feed documentโs contents.
For more information, see โUsage Plans and Rate Limitsโ in the Selling Partner API documentation.
- Parameters:
feedDocumentId โ string | * REQUIRED The identifier of the feed document.
- Return type:
- get_feed_result_document(self, feedDocumentId, **kwargs) str ๏
Returns the feed result documentโs contents. First fetches from getFeedDocument endpont and then fetchs from the URL returned from it.
For more information, see โUsage Plans and Rate Limitsโ in the Selling Partner API documentation.
- Parameters:
feedDocumentId โ str
**kwargs
- Return type:
str