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,
sig/peddler/apis/product_type_definitions_2020_09_01.rbs

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.

Defined Under Namespace

Classes: Error, ErrorList, ProductType, ProductTypeDefinition, ProductTypeList, ProductTypeVersion, PropertyGroup, SchemaLink

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #http, #initialize, #must_sandbox!, #patch, #percent_encode, #post, #put, #request, #sandbox, #sandbox?, #stringify_array, #timestamp, #user_agent

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", parentage_level: nil, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve an Amazon product type definition.

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 are populated within the product type definition schema, such as brand names associated with the selling partner.

  • marketplace_ids (Array<String>)

    A comma-delimited list of Amazon marketplace identifiers for the request. Note: This parameter is limited to one marketplaceId at this time.

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

    The version of the Amazon product type to retrieve. Defaults to "LATEST". 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.

  • 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 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).

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

    Locale for retrieving display labels and other presentation details. Defaults to the default language of the first marketplace in the request.

  • parentage_level (String) (defaults to: nil)

    The parentage level of the listing to retrieve a schema for. When provided, the schema is simplified by resolving all conditional logic related to the specified parentage level, resulting in a smaller schema with fewer conditions.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

  • (String)
  • (Array[String])
  • seller_id: (String, nil) (defaults to: nil)
  • product_type_version: (String, nil) (defaults to: "LATEST")
  • requirements: (String, nil) (defaults to: "LISTING")
  • requirements_enforced: (String, nil) (defaults to: "ENFORCED")
  • locale: (String, nil) (defaults to: "DEFAULT")
  • parentage_level: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 5.0)

Returns:



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

def get_definitions_product_type(product_type, marketplace_ids, seller_id: nil, product_type_version: "LATEST",
  requirements: "LISTING", requirements_enforced: "ENFORCED", locale: "DEFAULT", parentage_level: nil,
  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,
    "parentageLevel" => parentage_level,
  }.compact
  parser = -> { ProductTypeDefinition }
  get(path, params:, rate_limit:, 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.

Parameters:

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

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

  • marketplace_ids (Array<String>)

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

  • item_name (String) (defaults to: nil)

    Title of ASIN to get product type recommendation. Note: Cannot be used with keywords.

  • locale (String) (defaults to: nil)

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

  • search_locale (String) (defaults to: nil)

    Language used for keywords or itemName parameters. Defaults to primary locale of the marketplace.

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

  • (Array[String])
  • keywords: (Array[String], nil) (defaults to: nil)
  • item_name: (String, nil) (defaults to: nil)
  • locale: (String, nil) (defaults to: nil)
  • search_locale: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 5.0)

Returns:



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

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 }
  get(path, params:, rate_limit:, parser:)
end