Class: Peddler::APIs::ListingsItems20200901

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/listings_items_2020_09_01.rb,
lib/peddler/apis/listings_items_2020_09_01/error.rb,
lib/peddler/apis/listings_items_2020_09_01/issue.rb,
lib/peddler/apis/listings_items_2020_09_01/error_list.rb,
lib/peddler/apis/listings_items_2020_09_01/patch_operation.rb,
lib/peddler/apis/listings_items_2020_09_01/listings_item_put_request.rb,
lib/peddler/apis/listings_items_2020_09_01/listings_item_patch_request.rb,
lib/peddler/apis/listings_items_2020_09_01/listings_item_submission_response.rb

Overview

Selling Partner API for Listings Items

The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API.

For more information, see the href="https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2020-09-01-use-case-guide">https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2020-09-01-use-case-guide Listing Items API Use Case Guide.

Constant Summary collapse

Error =

Error response returned when the request is unsuccessful.

Structure.new do
  # @return [String] An error code that identifies the type of error that occurred.
  attribute(:code, String)

  # @return [String] A message that describes the error condition.
  attribute(:message, String)

  # @return [String] Additional details that can help the caller understand or fix the issue.
  attribute?(:details, String)
end
Issue =

An issue with a listings item.

Structure.new do
  # @return [String] An issue code that identifies the type of issue.
  attribute(:code, String)

  # @return [String] A message that describes the issue.
  attribute(:message, String)

  # @return [String] The severity of the issue.
  attribute(:severity, String)

  # @return [String] Name of the attribute associated with the issue, if applicable.
  attribute?(:attribute_name, String, from: "attributeName")
end
ErrorList =

A list of error responses returned when a request is unsuccessful.

Structure.new do
  # @return [Array<Error>]
  attribute(:errors, [Error])
end
PatchOperation =

Individual JSON Patch operation for an HTTP PATCH request.

Structure.new do
  # @return [String] Type of JSON Patch operation. Supported JSON Patch operations include add, replace, and
  # delete. See <https://tools.ietf.org/html/rfc6902>.
  attribute(:op, String)

  # @return [String] JSON Pointer path of the element to patch. See <https://tools.ietf.org/html/rfc6902>.
  attribute(:path, String)

  # @return [Array<Object>] JSON value to add, replace, or delete.
  attribute?(:value, Array)
end
ListingsItemPutRequest =

The request body schema for the putListingsItem operation.

Structure.new do
  # @return [Hash] JSON object containing structured listings item attribute data keyed by attribute name.
  attribute(:attributes, Hash)

  # @return [String] The Amazon product type of the listings item.
  attribute(:product_type, String, from: "productType")

  # @return [String] The name of the requirements set for the provided data.
  attribute?(:requirements, String)
end
ListingsItemPatchRequest =

The request body schema for the patchListingsItem operation.

Structure.new do
  # @return [Array<PatchOperation>] One or more JSON Patch operations to perform on the listings item.
  attribute(:patches, [PatchOperation])

  # @return [String] The Amazon product type of the listings item.
  attribute(:product_type, String, from: "productType")
end
ListingsItemSubmissionResponse =

Response containing the results of a submission to the Selling Partner API for Listings Items.

Structure.new do
  # @return [String] A selling partner provided identifier for an Amazon listing.
  attribute(:sku, String)

  # @return [String] The status of the listings item submission.
  attribute(:status, String)

  # @return [String] The unique identifier of the listings item submission.
  attribute(:submission_id, String, from: "submissionId")

  # @return [Array<Issue>] Listings item issues related to the listings item submission.
  attribute?(:issues, [Issue])
end

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Delete a listings item for a selling partner.

Note: The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to URL Encoding.

of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US" when a localization is not available in the specified locale.

Parameters:

  • seller_id (String)

    A selling partner identifier, such as a merchant account or vendor code.

  • sku (String)

    A selling partner provided identifier for an Amazon listing.

  • marketplace_ids (Array<String>)

    A comma-delimited list of Amazon marketplace identifiers for the request.

  • issue_locale (String) (defaults to: nil)

    A locale for localization of issues. When not provided, the default language code

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:



34
35
36
37
38
39
40
41
42
# File 'lib/peddler/apis/listings_items_2020_09_01.rb', line 34

def delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, rate_limit: 5.0)
  path = "/listings/2020-09-01/items/#{percent_encode(seller_id)}/#{percent_encode(sku)}"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
    "issueLocale" => issue_locale,
  }.compact
  parser = -> { ListingsItemSubmissionResponse }
  meter(rate_limit).delete(path, params:, parser:)
end

#patch_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported.

Note: The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to URL Encoding.

of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US" when a localization is not available in the specified locale.

Parameters:

  • seller_id (String)

    A selling partner identifier, such as a merchant account or vendor code.

  • sku (String)

    A selling partner provided identifier for an Amazon listing.

  • marketplace_ids (Array<String>)

    A comma-delimited list of Amazon marketplace identifiers for the request.

  • issue_locale (String) (defaults to: nil)

    A locale for localization of issues. When not provided, the default language code

  • body (Hash)

    The request body schema for the patchListingsItem operation.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:



61
62
63
64
65
66
67
68
69
# File 'lib/peddler/apis/listings_items_2020_09_01.rb', line 61

def patch_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0)
  path = "/listings/2020-09-01/items/#{percent_encode(seller_id)}/#{percent_encode(sku)}"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
    "issueLocale" => issue_locale,
  }.compact
  parser = -> { ListingsItemSubmissionResponse }
  meter(rate_limit).patch(path, body:, params:, parser:)
end

#put_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates a new or fully-updates an existing listings item for a selling partner.

Note: The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to URL Encoding.

of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US" when a localization is not available in the specified locale.

Parameters:

  • seller_id (String)

    A selling partner identifier, such as a merchant account or vendor code.

  • sku (String)

    A selling partner provided identifier for an Amazon listing.

  • marketplace_ids (Array<String>)

    A comma-delimited list of Amazon marketplace identifiers for the request.

  • issue_locale (String) (defaults to: nil)

    A locale for localization of issues. When not provided, the default language code

  • body (Hash)

    The request body schema for the putListingsItem operation.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:



87
88
89
90
91
92
93
94
95
# File 'lib/peddler/apis/listings_items_2020_09_01.rb', line 87

def put_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0)
  path = "/listings/2020-09-01/items/#{percent_encode(seller_id)}/#{percent_encode(sku)}"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
    "issueLocale" => issue_locale,
  }.compact
  parser = -> { ListingsItemSubmissionResponse }
  meter(rate_limit).put(path, body:, params:, parser:)
end