Class: Peddler::APIs::ProductTypeDefinitions20200901

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/product_type_definitions_2020_09_01.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/error.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/error_list.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/schema_link.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/product_type.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/property_group.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/product_type_list.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/product_type_version.rb,
lib/peddler/apis/product_type_definitions_2020_09_01/product_type_definition.rb

Overview

Selling Partner API for Product Type Definitions

The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds).

For more information, see the Product Type Definitions 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
ErrorList =

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

Structure.new do
  # @return [Array<Error>]
  attribute(:errors, [Error])
end
Structure.new do
  # @return [String] Checksum hash of the schema (Base64 MD5). Can be used to verify schema contents, identify
  # changes between schema versions, and for caching.
  attribute(:checksum, String)

  # @return [Hash] Link to retrieve the schema.
  attribute(:link, Hash)
end
ProductType =

An Amazon product type with a definition available.

Structure.new do
  # @return [String] The human-readable and localized description of the Amazon product type.
  attribute(:display_name, String, from: "displayName")

  # @return [Array<String>] The Amazon marketplace identifiers for which the product type definition is available.
  attribute(:marketplace_ids, [String], from: "marketplaceIds")

  # @return [String] The name of the Amazon product type.
  attribute(:name, String)
end
PropertyGroup =

A property group represents a logical grouping of schema properties that can be used for display or informational purposes.

Structure.new do
  # @return [String] The description of the property group.
  attribute?(:description, String)

  # @return [Array<String>] The names of the schema properties for the property group.
  attribute?(:property_names, [String], from: "propertyNames")

  # @return [String] The display label of the property group.
  attribute?(:title, String)
end
ProductTypeList =

A list of Amazon product types with definitions available.

Structure.new do
  # @return [String] Amazon product type version identifier.
  attribute(:product_type_version, String, from: "productTypeVersion")

  # @return [Array<ProductType>]
  attribute(:product_types, [ProductType], from: "productTypes")
end
ProductTypeVersion =

The version details for an Amazon product type.

Structure.new do
  # @return [:boolean] When true, the version indicated by the version identifier is the latest available for the
  # Amazon product type.
  attribute(:latest, :boolean)

  # @return [String] Version identifier.
  attribute(:version, String)

  # @return [:boolean] When true, the version indicated by the version identifier is the prerelease (release
  # candidate) for the Amazon product type.
  attribute?(:release_candidate, :boolean, from: "releaseCandidate")
end
ProductTypeDefinition =

A product type definition represents the attributes and data requirements for a product type in the Amazon catalog. Product type definitions are used interchangeably between the Selling Partner API for Listings Items, Selling Partner API for Catalog Items, and JSON-based listings feeds in the Selling Partner API for Feeds.

Structure.new do
  # @return [String] Human-readable and localized description of the Amazon product type.
  attribute(:display_name, String, from: "displayName")

  # @return [String] Locale of the display elements contained in the product type definition.
  attribute(:locale, String)

  # @return [Array<String>] Amazon marketplace identifiers for which the product type definition is applicable.
  attribute(:marketplace_ids, [String], from: "marketplaceIds")

  # @return [String] The name of the Amazon product type that this product type definition applies to.
  attribute(:product_type, String, from: "productType")

  # @return [ProductTypeVersion] The version details for the Amazon product type.
  attribute(:product_type_version, ProductTypeVersion, from: "productTypeVersion")

  # @return [Hash] Mapping of property group names to property groups. Property groups represent logical groupings
  # of schema properties that can be used for display or informational purposes.
  attribute(:property_groups, Hash, from: "propertyGroups")

  # @return [String] Name of the requirements set represented in this product type definition.
  attribute(:requirements, String)

  # @return [String] Identifies if the required attributes for a requirements set are enforced by the product type
  # definition schema. Non-enforced requirements enable structural validation of individual attributes without all
  # of the required attributes being present (such as for partial updates).
  attribute(:requirements_enforced, String, from: "requirementsEnforced")

  # @return [SchemaLink] Link to schema describing the attributes and requirements for the product type.
  attribute(:schema, SchemaLink)

  # @return [SchemaLink] Link to meta-schema describing the vocabulary used by the product type schema.
  attribute?(:meta_schema, SchemaLink, from: "metaSchema")
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_definitions_product_type(product_type, marketplace_ids, seller_id: nil, product_type_version: "LATEST", requirements: "LISTING", requirements_enforced: "ENFORCED", locale: "DEFAULT", rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve an Amazon product type definition.

are populated within the product type definition schema, such as brand names associated with the selling partner. Note: This parameter is limited to one marketplaceId at this time. Prerelease versions of product type definitions may be retrieved with "RELEASE_CANDIDATE". If no prerelease version is currently available, the "LATEST" live version will be provided. by the product type definition schema. Non-enforced requirements enable structural validation of individual attributes without all the required attributes being present (such as for partial updates). default language of the first marketplace in the request.

Parameters:

  • product_type (String)

    The Amazon product type name.

  • seller_id (String) (defaults to: nil)

    A selling partner identifier. When provided, seller-specific requirements and values

  • marketplace_ids (Array<String>)

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

  • product_type_version (String) (defaults to: "LATEST")

    The version of the Amazon product type to retrieve. Defaults to "LATEST",.

  • requirements (String) (defaults to: "LISTING")

    The name of the requirements set to retrieve requirements for.

  • requirements_enforced (String) (defaults to: "ENFORCED")

    Identifies if the required attributes for a requirements set are enforced

  • locale (String) (defaults to: "DEFAULT")

    Locale for retrieving display labels and other presentation details. Defaults to the

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/peddler/apis/product_type_definitions_2020_09_01.rb', line 67

def get_definitions_product_type(product_type, marketplace_ids, seller_id: nil, product_type_version: "LATEST",
  requirements: "LISTING", requirements_enforced: "ENFORCED", locale: "DEFAULT", rate_limit: 5.0)
  path = "/definitions/2020-09-01/productTypes/#{percent_encode(product_type)}"
  params = {
    "sellerId" => seller_id,
    "marketplaceIds" => stringify_array(marketplace_ids),
    "productTypeVersion" => product_type_version,
    "requirements" => requirements,
    "requirementsEnforced" => requirements_enforced,
    "locale" => locale,
  }.compact
  parser = -> { ProductTypeDefinition }
  meter(rate_limit).get(path, params:, parser:)
end

#search_definitions_product_types(marketplace_ids, keywords: nil, item_name: nil, locale: nil, search_locale: nil, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Search for and return a list of Amazon product types that have definitions available.

used with itemName. with keywords. marketplace. primary locale of the marketplace.

Parameters:

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

    A comma-delimited list of keywords to search product types. Note: Cannot be

  • marketplace_ids (Array<String>)

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

  • item_name (String) (defaults to: nil)

    The title of the ASIN to get the product type recommendation. Note: Cannot be used

  • locale (String) (defaults to: nil)

    The locale for the display names in the response. Defaults to the primary locale of the

  • search_locale (String) (defaults to: nil)

    The locale used for the keywords and itemName parameters. Defaults to the

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/peddler/apis/product_type_definitions_2020_09_01.rb', line 33

def search_definitions_product_types(marketplace_ids, keywords: nil, item_name: nil, locale: nil,
  search_locale: nil, rate_limit: 5.0)
  path = "/definitions/2020-09-01/productTypes"
  params = {
    "keywords" => stringify_array(keywords),
    "marketplaceIds" => stringify_array(marketplace_ids),
    "itemName" => item_name,
    "locale" => locale,
    "searchLocale" => search_locale,
  }.compact
  parser = -> { ProductTypeList }
  meter(rate_limit).get(path, params:, parser:)
end