Class: Peddler::APIs::Promotions20251201

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/promotions_2025_12_01.rb,
lib/peddler/apis/promotions_2025_12_01/item.rb,
lib/peddler/apis/promotions_2025_12_01/error.rb,
lib/peddler/apis/promotions_2025_12_01/issue.rb,
lib/peddler/apis/promotions_2025_12_01/budget.rb,
lib/peddler/apis/promotions_2025_12_01/discount.rb,
lib/peddler/apis/promotions_2025_12_01/schedule.rb,
lib/peddler/apis/promotions_2025_12_01/selection.rb,
lib/peddler/apis/promotions_2025_12_01/claim_code.rb,
lib/peddler/apis/promotions_2025_12_01/error_list.rb,
lib/peddler/apis/promotions_2025_12_01/item_issue.rb,
lib/peddler/apis/promotions_2025_12_01/pagination.rb,
lib/peddler/apis/promotions_2025_12_01/upfront_fee.rb,
lib/peddler/apis/promotions_2025_12_01/benefit_tier.rb,
lib/peddler/apis/promotions_2025_12_01/item_benefit.rb,
lib/peddler/apis/promotions_2025_12_01/variable_fee.rb,
lib/peddler/apis/promotions_2025_12_01/merchandising.rb,
lib/peddler/apis/promotions_2025_12_01/item_identifier.rb,
lib/peddler/apis/promotions_2025_12_01/latest_revision.rb,
lib/peddler/apis/promotions_2025_12_01/promotion_issue.rb,
lib/peddler/apis/promotions_2025_12_01/selection_rules.rb,
lib/peddler/apis/promotions_2025_12_01/amount_threshold.rb,
lib/peddler/apis/promotions_2025_12_01/customer_segment.rb,
lib/peddler/apis/promotions_2025_12_01/promotion_benefit.rb,
lib/peddler/apis/promotions_2025_12_01/promotion_summary.rb,
lib/peddler/apis/promotions_2025_12_01/selection_details.rb,
lib/peddler/apis/promotions_2025_12_01/purchase_condition.rb,
lib/peddler/apis/promotions_2025_12_01/quantity_threshold.rb,
lib/peddler/apis/promotions_2025_12_01/previewed_fee_rates.rb,
lib/peddler/apis/promotions_2025_12_01/brand_segment_details.rb,
lib/peddler/apis/promotions_2025_12_01/purchase_requirements.rb,
lib/peddler/apis/promotions_2025_12_01/get_promotion_response.rb,
lib/peddler/apis/promotions_2025_12_01/get_selection_response.rb,
lib/peddler/apis/promotions_2025_12_01/promotion_fee_snapshot.rb,
lib/peddler/apis/promotions_2025_12_01/customer_segment_details.rb,
lib/peddler/apis/promotions_2025_12_01/search_promotions_response.rb,
lib/peddler/apis/promotions_2025_12_01/promotion_revision_attributes.rb,
sig/peddler/apis/promotions_2025_12_01.rbs

Overview

The Selling Partner API for Promotions

The Selling Partner API for Promotions enables selling partners to create and manage promotions.

Defined Under Namespace

Classes: AmountThreshold, BenefitTier, BrandSegmentDetails, Budget, ClaimCode, CustomerSegment, CustomerSegmentDetails, Discount, Error, ErrorList, GetPromotionResponse, GetSelectionResponse, Issue, Item, ItemBenefit, ItemIdentifier, ItemIssue, LatestRevision, Merchandising, Pagination, PreviewedFeeRates, PromotionBenefit, PromotionFeeSnapshot, PromotionIssue, PromotionRevisionAttributes, PromotionSummary, PurchaseCondition, PurchaseRequirements, QuantityThreshold, Schedule, SearchPromotionsResponse, Selection, SelectionDetails, SelectionRules, UpfrontFee, VariableFee

Constant Summary

Constants inherited from Peddler::API

Peddler::API::TRANSIENT_STATUSES

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #base_url, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #host_header, #http, #initialize, #must_sandbox!, #parse_base_url, #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_promotion(promotion_id, included_data: nil, locale: "en_US") ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve details of a specified promotion.

Parameters:

  • promotion_id (String)

    The ID of the promotion.

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

    A comma-delimited list of datasets to include in the response.

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

    The locale of the promotion. Formatted as an ISO 639 language code, followed by an underscore, followed by an ISO 3166-1 alpha-2 country code.

  • (String)
  • included_data: (Array[String], nil) (defaults to: nil)
  • locale: (String, nil) (defaults to: "en_US")

Returns:



84
85
86
87
88
89
90
91
92
# File 'lib/peddler/apis/promotions_2025_12_01.rb', line 84

def get_promotion(promotion_id, included_data: nil, locale: "en_US")
  path = "/promotions/2025-12-01/promotions/#{percent_encode(promotion_id)}"
  params = {
    "includedData" => stringify_array(included_data),
    "locale" => locale,
  }.compact
  parser = -> { GetPromotionResponse }
  get(path, params:, parser:)
end

#get_selection(promotion_id, selection_id, revision_id, locale: "en_US", pagination_token: nil, limit: 20, included_data: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve up to 100 product items that are associated with a specified promotion. This operation only supports items found in SelectionType.ITEMS. Items found in SelectionType.CATALOG are not supported. Selection objects always include selectionDetails with item information.

Parameters:

  • promotion_id (String)

    The ID of the promotion.

  • selection_id (String)

    The ID of the selection.

  • revision_id (Integer)

    The revision identifier for the selection. Use the revisionId from the getPromotion response. A promotion may have multiple selection revisions when an update is in progress. Passing the correct revisionId ensures you retrieve the expected data.

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

    The locale of the promotion. Formatted as an ISO 639 language code, followed by an underscore, followed by an ISO 3166-1 alpha-2 country code.

  • pagination_token (String) (defaults to: nil)

    A token that you use to retrieve the next page of results. The response includes paginationToken when the number of results exceeds the specified limit value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until paginationToken is null. Note that this operation can return empty pages.

  • limit (Integer) (defaults to: 20)

    The maximum number of response results per page.

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

    A comma-delimited list of datasets to include in the response.

  • (String)
  • (String)
  • (Integer)
  • locale: (String, nil) (defaults to: "en_US")
  • pagination_token: (String, nil) (defaults to: nil)
  • limit: (Integer, nil) (defaults to: 20)
  • included_data: (Array[String], nil) (defaults to: nil)

Returns:



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/peddler/apis/promotions_2025_12_01.rb', line 114

def get_selection(promotion_id, selection_id, revision_id, locale: "en_US", pagination_token: nil, limit: 20,
  included_data: nil)
  path = "/promotions/2025-12-01/promotions/#{percent_encode(promotion_id)}/selections/#{percent_encode(selection_id)}"
  params = {
    "revisionId" => revision_id,
    "locale" => locale,
    "paginationToken" => pagination_token,
    "limit" => limit,
    "includedData" => stringify_array(included_data),
  }.compact
  parser = -> { GetSelectionResponse }
  get(path, params:, parser:)
end

#search_promotions(marketplace_ids, locale: "en_US", statuses: nil, asins: nil, skus: nil, promotion_types: nil, start_date_before: nil, start_date_after: nil, end_date_before: nil, end_date_after: nil, update_date_after: nil, update_date_before: nil, pagination_token: nil, revision: "PUBLISHED", limit: 20, included_data: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Search and filter promotions based on various criteria. Returns a paginated list of promotion summaries.

Parameters:

  • marketplace_ids (Array<String>)

    The Amazon stores from which to retrieve promotions. Refer to Store Identifiers for a list of Amazon store values.

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

    The locale from which to retrieve promotions. Formatted as an ISO 639 language code, followed by an underscore, followed by an ISO 3166-1 alpha-2 country code.

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

    The statuses of promotions to retrieve, formatted as a comma-delimited list.

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

    The ASINs to which promotions apply, formatted as a comma-delimited list.

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

    The SKUs to which promotions apply, formatted as a comma-delimited list.

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

    The promotion types to which promotions apply, formatted as a comma-delimited list.

  • start_date_before (String) (defaults to: nil)

    Promotions that start before this date are returned. Formatted in ISO 8601 format, including the timezone. For example: 1970-01-01T00:00:00-07:00.

  • start_date_after (String) (defaults to: nil)

    Promotions that start after this date are returned. Formatted in ISO 8601 format, including the timezone. For example: 1970-01-01T00:00:00-07:00.

  • end_date_before (String) (defaults to: nil)

    Promotions that end before this date are returned. Formatted in ISO 8601 format, including the timezone. For example: 1970-01-01T00:00:00-07:00.

  • end_date_after (String) (defaults to: nil)

    Promotions that end after this date are returned. Formatted in ISO 8601 format, including the timezone. For example: 1970-01-01T00:00:00-07:00.

  • update_date_after (String) (defaults to: nil)

    Filter promotions that were last modified after this timestamp. Zoned Datetime in ISO 8601 format (e.g., 1970-01-01T00:00:00-07:00).

  • update_date_before (String) (defaults to: nil)

    Filter promotions that were last modified before this timestamp. Zoned Datetime in ISO 8601 format (e.g., 1970-01-01T00:00:00-07:00).

  • pagination_token (String) (defaults to: nil)

    A token that you use to retrieve the next page of results. The response includes paginationToken when the number of results exceeds the specified limit value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until paginationToken is null. Note that this operation can return empty pages.

  • revision (String) (defaults to: "PUBLISHED")

    Specifies which promotion revision or revisions to match against when filtering. This controls which promotions are included in search results, not the shape of the response. The response always returns the published revision in the main body, with latestRevision included when the latest revision diverges.

  • limit (Integer) (defaults to: 20)

    The maximum number of response results per page.

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

    A comma-delimited list of datasets to include in the response.

  • (Array[String])
  • locale: (String, nil) (defaults to: "en_US")
  • statuses: (Array[String], nil) (defaults to: nil)
  • asins: (Array[String], nil) (defaults to: nil)
  • skus: (Array[String], nil) (defaults to: nil)
  • promotion_types: (Array[String], nil) (defaults to: nil)
  • start_date_before: (String, nil) (defaults to: nil)
  • start_date_after: (String, nil) (defaults to: nil)
  • end_date_before: (String, nil) (defaults to: nil)
  • end_date_after: (String, nil) (defaults to: nil)
  • update_date_after: (String, nil) (defaults to: nil)
  • update_date_before: (String, nil) (defaults to: nil)
  • pagination_token: (String, nil) (defaults to: nil)
  • revision: (String, nil) (defaults to: "PUBLISHED")
  • limit: (Integer, nil) (defaults to: 20)
  • included_data: (Array[String], nil) (defaults to: nil)

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/peddler/apis/promotions_2025_12_01.rb', line 49

def search_promotions(marketplace_ids, locale: "en_US", statuses: nil, asins: nil, skus: nil,
  promotion_types: nil, start_date_before: nil, start_date_after: nil, end_date_before: nil, end_date_after: nil,
  update_date_after: nil, update_date_before: nil, pagination_token: nil, revision: "PUBLISHED", limit: 20,
  included_data: nil)
  path = "/promotions/2025-12-01/promotions"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
    "locale" => locale,
    "statuses" => stringify_array(statuses),
    "asins" => stringify_array(asins),
    "skus" => stringify_array(skus),
    "promotionTypes" => stringify_array(promotion_types),
    "startDateBefore" => start_date_before,
    "startDateAfter" => start_date_after,
    "endDateBefore" => end_date_before,
    "endDateAfter" => end_date_after,
    "updateDateAfter" => update_date_after,
    "updateDateBefore" => update_date_before,
    "paginationToken" => pagination_token,
    "revision" => revision,
    "limit" => limit,
    "includedData" => stringify_array(included_data),
  }.compact
  parser = -> { SearchPromotionsResponse }
  get(path, params:, parser:)
end