Feeds

class sp_api.api.Feeds(marketplace: 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)

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:

ApiResponse

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:

[ApiResponse

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:
Return type:

ApiResponse

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:

ApiResponse

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:

ApiResponse

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:

ApiResponse

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:

ApiResponse

get_feed_result_document(self, feedDocumentId, **kwargs) str

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 – str

  • **kwargs

Return type:

ApiResponse