class Peddler::API::FBAInventoryV1

Selling Partner API for FBA Inventory

The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in Amazon’s fulfillment network.

Public Instance Methods

add_inventory(x_amzn_idempotency_token, add_inventory_request_body, rate_limit: nil) click to toggle source

Requests that Amazon add items to the Sandbox Inventory with desired amount of quantity in the sandbox environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API sandbox](developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.

@note This operation can make a dynamic sandbox call. @param x_amzn_idempotency_token [String] A unique token/requestId provided with each call to ensure idempotency. @param add_inventory_request_body [Hash] List of items to add to Sandbox inventory. @param rate_limit [Float] Requests per second @return [Hash] The API response

# File lib/peddler/api/fba_inventory_v1.rb, line 112
def add_inventory(x_amzn_idempotency_token, add_inventory_request_body, rate_limit: nil)
  must_sandbox!

  path = "/fba/inventory/v1/items/inventory"
  body = add_inventory_request_body

  post(path, body:)
end
create_inventory_item(create_inventory_item_request_body, rate_limit: nil) click to toggle source

Requests that Amazon create product-details in the Sandbox Inventory in the sandbox environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API sandbox](developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.

@note This operation can make a dynamic sandbox call. @param create_inventory_item_request_body [Hash] CreateInventoryItem Request Body Parameter. @param rate_limit [Float] Requests per second @return [Hash] The API response

# File lib/peddler/api/fba_inventory_v1.rb, line 73
def create_inventory_item(create_inventory_item_request_body, rate_limit: nil)
  must_sandbox!

  path = "/fba/inventory/v1/items"
  body = create_inventory_item_request_body

  post(path, body:)
end
delete_inventory_item(seller_sku, marketplace_id, rate_limit: nil) click to toggle source

Requests that Amazon Deletes an item from the Sandbox Inventory in the sandbox environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Selling Partner API sandbox](developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.

@note This operation can make a dynamic sandbox call. @param seller_sku [String] A single seller SKU used for querying the specified seller SKU inventory summaries. @param marketplace_id [String] The marketplace ID for the marketplace for which the sellerSku is to be deleted. @param rate_limit [Float] Requests per second @return [Hash] The API response

# File lib/peddler/api/fba_inventory_v1.rb, line 91
def delete_inventory_item(seller_sku, marketplace_id, rate_limit: nil)
  must_sandbox!

  path = "/fba/inventory/v1/items/#{seller_sku}"
  params = {
    "marketplaceId" => marketplace_id,
  }.compact

  delete(path, params:)
end
get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, details: nil, start_date_time: nil, seller_skus: nil, seller_sku: nil, next_token: nil, rate_limit: 2.0) click to toggle source

Returns a list of inventory summaries. The summaries returned depend on the presence or absence of the startDateTime, sellerSkus and sellerSku parameters: - All inventory summaries with available details are returned when the startDateTime, sellerSkus and sellerSku parameters are omitted. - When startDateTime is provided, the operation returns inventory summaries that have had changes after the date and time specified. The sellerSkus and sellerSku parameters are ignored. Important: To avoid errors, use both startDateTime and nextToken to get the next page of inventory summaries that have changed after the date and time specified. - When the sellerSkus parameter is provided, the operation returns inventory summaries for only the specified sellerSkus. The sellerSku parameter is ignored. - When the sellerSku parameter is provided, the operation returns inventory summaries for only the specified sellerSku. 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](developer-docs.amazon.com/sp-api/docs/url-encoding).

@note This operation can make a dynamic sandbox call. @param details [Boolean] true to return inventory summaries with additional summarized inventory details and

quantities. Otherwise, returns inventory summaries only (default value).

@param granularity_type [String] The granularity type for the inventory aggregation level. @param granularity_id [String] The granularity ID for the inventory aggregation level. @param start_date_time [String] A start date and time in ISO8601 format. If specified, all inventory summaries

that have changed since then are returned. You must specify a date and time that is no earlier than 18 months
prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity,
inboundShippedQuantity and inboundReceivingQuantity are not detected.

@param seller_skus [Array<String>] A list of seller SKUs for which to return inventory summaries. You may

specify up to 50 SKUs.

@param seller_sku [String] A single seller SKU used for querying the specified seller SKU inventory summaries. @param next_token [String] String token returned in the response of your previous request. The string token will

expire 30 seconds after being created.

@param marketplace_ids [Array<String>] The marketplace ID for the marketplace for which to return inventory

summaries.

@param rate_limit [Float] Requests per second @return [Hash] The API response

# File lib/peddler/api/fba_inventory_v1.rb, line 48
def get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, details: nil, start_date_time: nil,
  seller_skus: nil, seller_sku: nil, next_token: nil, rate_limit: 2.0)
  path = "/fba/inventory/v1/summaries"
  params = {
    "details" => details,
    "granularityType" => granularity_type,
    "granularityId" => granularity_id,
    "startDateTime" => start_date_time,
    "sellerSkus" => seller_skus,
    "sellerSku" => seller_sku,
    "nextToken" => next_token,
    "marketplaceIds" => marketplace_ids,
  }.compact

  meter(rate_limit).get(path, params:)
end