Class: Peddler::APIs::CatalogItems20201201

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/catalog_items_2020_12_01.rb,
lib/peddler/apis/catalog_items_2020_12_01/item.rb,
lib/peddler/apis/catalog_items_2020_12_01/error.rb,
lib/peddler/apis/catalog_items_2020_12_01/error_list.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_image.rb,
lib/peddler/apis/catalog_items_2020_12_01/pagination.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_images.rb,
lib/peddler/apis/catalog_items_2020_12_01/refinements.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_summaries.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_identifier.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_sales_rank.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_variations.rb,
lib/peddler/apis/catalog_items_2020_12_01/brand_refinement.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_identifiers.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_sales_ranks.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_product_types.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_search_results.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_vendor_details.rb,
lib/peddler/apis/catalog_items_2020_12_01/classification_refinement.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_images_by_marketplace.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_summary_by_marketplace.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_variations_by_marketplace.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_identifiers_by_marketplace.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_sales_ranks_by_marketplace.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_product_type_by_marketplace.rb,
lib/peddler/apis/catalog_items_2020_12_01/item_vendor_details_by_marketplace.rb

Overview

Selling Partner API for Catalog Items

The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog.

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

Defined Under Namespace

Classes: ItemIdentifiers, ItemImages, ItemProductTypes, ItemSalesRanks, ItemSummaries, ItemVariations, ItemVendorDetails

Constant Summary collapse

Item =

An item in the Amazon catalog.

Structure.new do
  # @return [String]
  attribute(:asin, String)

  # @return [Hash]
  attribute?(:attributes, Hash)

  # @return [Array<ItemIdentifiersByMarketplace>]
  attribute?(:identifiers, [ItemIdentifiersByMarketplace])

  # @return [Array<ItemImagesByMarketplace>]
  attribute?(:images, [ItemImagesByMarketplace])

  # @return [Array<ItemProductTypeByMarketplace>]
  attribute?(:product_types, [ItemProductTypeByMarketplace], from: "productTypes")

  # @return [Array<ItemSalesRanksByMarketplace>]
  attribute?(:sales_ranks, [ItemSalesRanksByMarketplace], from: "salesRanks")

  # @return [Array<ItemSummaryByMarketplace>]
  attribute?(:summaries, [ItemSummaryByMarketplace])

  # @return [Array<ItemVariationsByMarketplace>]
  attribute?(:variations, [ItemVariationsByMarketplace])

  # @return [Array<ItemVendorDetailsByMarketplace>]
  attribute?(:vendor_details, [ItemVendorDetailsByMarketplace], from: "vendorDetails")
end
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
ErrorList =

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

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

Image for an item in the Amazon catalog.

Structure.new do
  # @return [Integer] Height of the image in pixels.
  attribute(:height, Integer)

  # @return [String] Link, or URL, for the image.
  attribute(:link, String)

  # @return [String] Variant of the image, such as MAIN or PT01.
  attribute(:variant, String)

  # @return [Integer] Width of the image in pixels.
  attribute(:width, Integer)
end
Pagination =

When a request produces a response that exceeds the pageSize, pagination occurs. This means the response is divided into individual pages. To retrieve the next page or the previous page, you must pass the nextToken value or the previousToken value as the pageToken parameter in the next request. When you receive the last page, there will be no nextToken key in the pagination object.

Structure.new do
  # @return [String] A token that can be used to fetch the next page.
  attribute?(:next_token, String, from: "nextToken")

  # @return [String] A token that can be used to fetch the previous page.
  attribute?(:previous_token, String, from: "previousToken")
end
Refinements =

Search refinements.

Structure.new do
  # @return [Array<BrandRefinement>] Brand search refinements.
  attribute(:brands, [BrandRefinement])

  # @return [Array<ClassificationRefinement>] Classification search refinements.
  attribute(:classifications, [ClassificationRefinement])
end
ItemIdentifier =

Identifier associated with the item in the Amazon catalog, such as a UPC or EAN identifier.

Structure.new do
  # @return [String] Identifier.
  attribute(:identifier, String)

  # @return [String] Type of identifier, such as UPC, EAN, or ISBN.
  attribute(:identifier_type, String, from: "identifierType")
end
ItemSalesRank =

Sales rank of an Amazon catalog item.

Structure.new do
  # @return [Integer] Sales rank value.
  attribute(:rank, Integer)

  # @return [String] Title, or name, of the sales rank.
  attribute(:title, String)

  # @return [String] Corresponding Amazon retail website link, or URL, for the sales rank.
  attribute?(:link, String)
end
BrandRefinement =

Description of a brand that can be used to get more fine-grained search results.

Structure.new do
  # @return [String] Brand name. For display and can be used as a search refinement.
  attribute(:brand_name, String, from: "brandName")

  # @return [Integer] The estimated number of results that would still be returned if refinement key applied.
  attribute(:number_of_results, Integer, from: "numberOfResults")
end
ItemSearchResults =

Items in the Amazon catalog and search related metadata.

Structure.new do
  # @return [Array<Item>] A list of items from the Amazon catalog.
  attribute(:items, [Item])

  # @return [Integer] The estimated total number of products matched by the search query (only results up to the
  # page count limit will be returned per request regardless of the number found).
  #
  # Note: The maximum number of items (ASINs) that can be returned and paged through is 1000.
  attribute(:number_of_results, Integer, from: "numberOfResults")

  # @return [Pagination] If available, the nextToken and/or previousToken values required to return paginated
  # results.
  attribute(:pagination, Pagination)

  # @return [Refinements]
  attribute(:refinements, Refinements)
end
ClassificationRefinement =

Description of a classification that can be used to get more fine-grained search results.

Structure.new do
  # @return [String] Identifier for the classification that can be used for search refinement purposes.
  attribute(:classification_id, String, from: "classificationId")

  # @return [String] Display name for the classification.
  attribute(:display_name, String, from: "displayName")

  # @return [Integer] The estimated number of results that would still be returned if refinement key applied.
  attribute(:number_of_results, Integer, from: "numberOfResults")
end
ItemImagesByMarketplace =

Images for an item in the Amazon catalog for the indicated Amazon marketplace.

Structure.new do
  # @return [Array<ItemImage>] Images for an item in the Amazon catalog for the indicated Amazon marketplace.
  attribute(:images, [ItemImage])

  # @return [String] Amazon marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")
end
ItemSummaryByMarketplace =

Summary details of an Amazon catalog item for the indicated Amazon marketplace.

Structure.new do
  # @return [String] Amazon marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] Name of the brand associated with an Amazon catalog item.
  attribute?(:brand_name, String, from: "brandName")

  # @return [String] Identifier of the browse node associated with an Amazon catalog item.
  attribute?(:browse_node, String, from: "browseNode")

  # @return [String] Name of the color associated with an Amazon catalog item.
  attribute?(:color_name, String, from: "colorName")

  # @return [String] Name, or title, associated with an Amazon catalog item.
  attribute?(:item_name, String, from: "itemName")

  # @return [String] Name of the manufacturer associated with an Amazon catalog item.
  attribute?(:manufacturer, String)

  # @return [String] Model number associated with an Amazon catalog item.
  attribute?(:model_number, String, from: "modelNumber")

  # @return [String] Name of the size associated with an Amazon catalog item.
  attribute?(:size_name, String, from: "sizeName")

  # @return [String] Name of the style associated with an Amazon catalog item.
  attribute?(:style_name, String, from: "styleName")
end
ItemVariationsByMarketplace =

Variation details for the Amazon catalog item for the indicated Amazon marketplace.

Structure.new do
  # @return [Array<String>] Identifiers (ASINs) of the related items.
  attribute(:asins, [String])

  # @return [String] Amazon marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] Type of variation relationship of the Amazon catalog item in the request to the related
  # item(s): "PARENT" or "CHILD".
  attribute(:variation_type, String, from: "variationType")
end
ItemIdentifiersByMarketplace =

Identifiers associated with the item in the Amazon catalog for the indicated Amazon marketplace.

Structure.new do
  # @return [Array<ItemIdentifier>] Identifiers associated with the item in the Amazon catalog for the indicated
  # Amazon marketplace.
  attribute(:identifiers, [ItemIdentifier])

  # @return [String] Amazon marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")
end
ItemSalesRanksByMarketplace =

Sales ranks of an Amazon catalog item for the indicated Amazon marketplace.

Structure.new do
  # @return [String] Amazon marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [Array<ItemSalesRank>] Sales ranks of an Amazon catalog item for an Amazon marketplace.
  attribute(:ranks, [ItemSalesRank])
end
ItemProductTypeByMarketplace =

Product type associated with the Amazon catalog item for the indicated Amazon marketplace.

Structure.new do
  # @return [String] Amazon marketplace identifier.
  attribute?(:marketplace_id, String, from: "marketplaceId")

  # @return [String] Name of the product type associated with the Amazon catalog item.
  attribute?(:product_type, String, from: "productType")
end
ItemVendorDetailsByMarketplace =

Vendor details associated with an Amazon catalog item for the indicated Amazon marketplace.

Structure.new do
  # @return [String] Amazon marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] Brand code associated with an Amazon catalog item.
  attribute?(:brand_code, String, from: "brandCode")

  # @return [String] Product category associated with an Amazon catalog item.
  attribute?(:category_code, String, from: "categoryCode")

  # @return [String] Manufacturer code associated with an Amazon catalog item.
  attribute?(:manufacturer_code, String, from: "manufacturerCode")

  # @return [String] Parent vendor code of the manufacturer code.
  attribute?(:manufacturer_code_parent, String, from: "manufacturerCodeParent")

  # @return [String] Product group associated with an Amazon catalog item.
  attribute?(:product_group, String, from: "productGroup")

  # @return [String] Replenishment category associated with an Amazon catalog item.
  attribute?(:replenishment_category, String, from: "replenishmentCategory")

  # @return [String] Product subcategory associated with an Amazon catalog item.
  attribute?(:subcategory_code, String, from: "subcategoryCode")
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

#get_catalog_item(asin, marketplace_ids, included_data: ["summaries"], locale: nil, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieves details for an item in the Amazon catalog.

the response contain data only for the specified marketplaces. summaries. marketplace.

Parameters:

  • asin (String)

    The Amazon Standard Identification Number (ASIN) of the item.

  • marketplace_ids (Array<String>)

    A comma-delimited list of Amazon marketplace identifiers. Data sets in

  • included_data (Array<String>) (defaults to: ["summaries"])

    A comma-delimited list of data sets to include in the response. Default:

  • locale (String) (defaults to: nil)

    Locale for retrieving localized summaries. Defaults to the primary locale of the

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

Returns:



67
68
69
70
71
72
73
74
75
76
# File 'lib/peddler/apis/catalog_items_2020_12_01.rb', line 67

def get_catalog_item(asin, marketplace_ids, included_data: ["summaries"], locale: nil, rate_limit: 2.0)
  path = "/catalog/2020-12-01/items/#{percent_encode(asin)}"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
    "includedData" => stringify_array(included_data),
    "locale" => locale,
  }.compact
  parser = -> { Item }
  meter(rate_limit).get(path, params:, parser:)
end

#search_catalog_items(keywords, marketplace_ids, included_data: ["summaries"], brand_names: nil, classification_ids: nil, page_size: 10, page_token: nil, keywords_locale: nil, locale: nil, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Search for and return a list of Amazon catalog items and associated information.

for. summaries. search to. marketplace. marketplace.

Parameters:

  • keywords (Array<String>)

    A comma-delimited list of words or item identifiers to search the Amazon catalog

  • marketplace_ids (Array<String>)

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

  • included_data (Array<String>) (defaults to: ["summaries"])

    A comma-delimited list of data sets to include in the response. Default:

  • brand_names (Array<String>) (defaults to: nil)

    A comma-delimited list of brand names to limit the search to.

  • classification_ids (Array<String>) (defaults to: nil)

    A comma-delimited list of classification identifiers to limit the

  • page_size (Integer) (defaults to: 10)

    Number of results to be returned per page.

  • page_token (String) (defaults to: nil)

    A token to fetch a certain page when there are multiple pages worth of results.

  • keywords_locale (String) (defaults to: nil)

    The language the keywords are provided in. Defaults to the primary locale of the

  • locale (String) (defaults to: nil)

    Locale for retrieving localized summaries. Defaults to the primary locale of the

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/peddler/apis/catalog_items_2020_12_01.rb', line 37

def search_catalog_items(keywords, marketplace_ids, included_data: ["summaries"], brand_names: nil,
  classification_ids: nil, page_size: 10, page_token: nil, keywords_locale: nil, locale: nil, rate_limit: 2.0)
  path = "/catalog/2020-12-01/items"
  params = {
    "keywords" => stringify_array(keywords),
    "marketplaceIds" => stringify_array(marketplace_ids),
    "includedData" => stringify_array(included_data),
    "brandNames" => stringify_array(brand_names),
    "classificationIds" => stringify_array(classification_ids),
    "pageSize" => page_size,
    "pageToken" => page_token,
    "keywordsLocale" => keywords_locale,
    "locale" => locale,
  }.compact
  parser = -> { ItemSearchResults }
  meter(rate_limit).get(path, params:, parser:)
end