Class: Peddler::APIs::ExternalFulfillmentShipments20240911

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/tax.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/error.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/amount.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/charge.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/weight.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/address.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/charges.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/package.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/distance.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/document.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/geocodes.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/packages.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipment.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/dimension.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/line_item.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/error_list.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/pagination.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/document_v2.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/time_window.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/cancellation.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/invoice_info.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/cancellations.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipment_info.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipping_info.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/charge_breakup.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/gift_attributes.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/custom_attribute.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/invoice_response.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipping_options.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/handover_location.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/package_line_item.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/ship_labels_input.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/original_line_item.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/package_dimensions.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/package_line_items.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/package_ship_label.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipment_line_item.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipments_response.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/invoice_requirement.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/original_line_items.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/recommended_package.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/ship_label_metadata.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/recommended_packages.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/ship_labels_response.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/compliance_attributes.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/line_item_with_reason.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipment_requirements.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/tax_registration_info.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/marketplace_attributes.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/replaced_shipment_info.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/package_delivery_status.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/package_ship_label_list.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/custom_channel_attribute.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/packing_slip_requirement.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/sandbox_shipment_updates.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/party_identification_info.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipping_options_response.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/courier_supported_attributes.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/recommended_package_line_item.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/party_identification_info_list.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/recommended_package_line_items.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/create_sandbox_shipment_request.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/update_sandbox_shipment_request.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/create_sandbox_shipment_response.rb,
lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipment_acknowledgement_request.rb,
sig/peddler/apis/external_fulfillment_shipments_2024_09_11.rbs

Overview

The Selling Partner API for Amazon External Fulfillment Shipments Processing

You can use the External Fulfillment Shipments API to retrieve, manage, and track shipments processed through Amazon's external fulfillment network. Use this API to get shipment details, monitor status changes, and access fulfillment requirements.

Defined Under Namespace

Classes: Address, Amount, Cancellation, Cancellations, Charge, ChargeBreakup, Charges, ComplianceAttributes, CourierSupportedAttributes, CreateSandboxShipmentRequest, CreateSandboxShipmentResponse, CustomAttribute, CustomChannelAttribute, Dimension, Distance, Document, DocumentV2, Error, ErrorList, Geocodes, GiftAttributes, HandoverLocation, InvoiceInfo, InvoiceRequirement, InvoiceResponse, LineItem, LineItemWithReason, MarketplaceAttributes, OriginalLineItem, OriginalLineItems, Package, PackageDeliveryStatus, PackageDimensions, PackageLineItem, PackageLineItems, PackageShipLabel, PackageShipLabelList, Packages, PackingSlipRequirement, Pagination, PartyIdentificationInfo, PartyIdentificationInfoList, RecommendedPackage, RecommendedPackageLineItem, RecommendedPackageLineItems, RecommendedPackages, ReplacedShipmentInfo, SandboxShipmentUpdates, ShipLabelMetadata, ShipLabelsInput, ShipLabelsResponse, Shipment, ShipmentAcknowledgementRequest, ShipmentInfo, ShipmentLineItem, ShipmentRequirements, ShipmentsResponse, ShippingInfo, ShippingOptions, ShippingOptionsResponse, Tax, TaxRegistrationInfo, TimeWindow, UpdateSandboxShipmentRequest, Weight

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

#create_packages(shipment_id, body) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Provide details about the packages in the specified shipment.

Parameters:

  • shipment_id (String) —

    The ID of the shipment.

  • body (Hash) —

    A list of packages in the shipment.

  • (String)
  • (Hash[untyped, untyped])

Returns:



113
114
115
116
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 113

def create_packages(shipment_id, body)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}/packages"
  post(path, body:)
end

#create_sandbox_shipment(body) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Creates a sandbox shipment to simulate order creation in the test environment. This operation is available only in the sandbox environment. The shipment is created with the specified configuration including shipping type and order type.

Parameters:

  • body (Hash) —

    The request body for creating a sandbox shipment.

  • (Hash[untyped, untyped])

Returns:



59
60
61
62
63
64
65
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 59

def create_sandbox_shipment(body)
  must_sandbox!

  path = "/externalFulfillment/2024-09-11/shipments"
  parser = -> { CreateSandboxShipmentResponse }
  post(path, body:, parser:)
end

#generate_invoice(shipment_id) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Get invoices for the shipment you specify.

Parameters:

  • shipment_id (String) —

    The ID of the shipment whose invoice you want.

  • (String)

Returns:



168
169
170
171
172
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 168

def generate_invoice(shipment_id)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}/invoice"
  parser = -> { InvoiceResponse }
  post(path, parser:)
end

#generate_ship_labels(shipment_id, operation, shipping_option_id: nil, body: nil) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Generate and retrieve all shipping labels for one or more packages in the shipment you specify.

Parameters:

  • shipment_id (String) —

    The ID of the shipment whose shipping labels you want to generate and retrieve.

  • shipping_option_id (String) (defaults to: nil) —

    The ID of the shipping option whose shipping labels you want.

  • operation (String) —

    Specify whether you want to generate or regenerate a label.

  • body (Hash) (defaults to: nil) —

    Shipping details for when shipping is not done by the marketplace channel.

  • (String)
  • (String)
  • shipping_option_id: (String, nil) (defaults to: nil)
  • body: (Hash[untyped, untyped], nil) (defaults to: nil)

Returns:



193
194
195
196
197
198
199
200
201
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 193

def generate_ship_labels(shipment_id, operation, shipping_option_id: nil, body: nil)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}/shipLabels"
  params = {
    "shippingOptionId" => shipping_option_id,
    "operation" => operation,
  }.compact
  parser = -> { ShipLabelsResponse }
  put(path, body:, params:, parser:)
end

#get_shipment(shipment_id) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Get a single shipment with the ID you specify.

Parameters:

  • shipment_id (String) —

    The ID of the shipment you want to retrieve.

  • (String)

Returns:



86
87
88
89
90
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 86

def get_shipment(shipment_id)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}"
  parser = -> { Shipment }
  get(path, parser:)
end

#get_shipments(status, location_id: nil, marketplace_id: nil, channel_name: nil, last_updated_after: nil, last_updated_before: nil, max_results: nil, pagination_token: nil) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Get a list of shipments created for the seller in the status you specify. Shipments can be further filtered based on the fulfillment node or the time of the shipments' last update.

Parameters:

  • location_id (String) (defaults to: nil) —

    The Amazon channel location identifier for the shipments you want to retrieve.

  • marketplace_id (String) (defaults to: nil) —

    The marketplace ID associated with the location. To find the ID for your marketplace, refer to Marketplace IDs.

  • channel_name (String) (defaults to: nil) —

    The channel name associated with the location.

  • status (String) —

    The status of shipment you want to include in the response. To retrieve all new shipments, set this value to CREATED or ACCEPTED.

  • last_updated_after (String) (defaults to: nil) —

    The response includes shipments whose latest update is after the specified time. In ISO 8601 date-time format.

  • last_updated_before (String) (defaults to: nil) —

    The response includes shipments whose latest update is before the specified time. In ISO 8601 date-time format.

  • max_results (Integer) (defaults to: nil) —

    The maximum number of shipments to include in the response.

  • pagination_token (String) (defaults to: nil) —

    A token that you use to retrieve the next page of results. The response includes nextToken when there are multiple pages of results. 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 nextToken is null. Note that this operation can return empty pages.

  • (String)
  • location_id: (String, nil) (defaults to: nil)
  • marketplace_id: (String, nil) (defaults to: nil)
  • channel_name: (String, nil) (defaults to: nil)
  • last_updated_after: (String, nil) (defaults to: nil)
  • last_updated_before: (String, nil) (defaults to: nil)
  • max_results: (Integer, nil) (defaults to: nil)
  • pagination_token: (String, nil) (defaults to: nil)

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 35

def get_shipments(status, location_id: nil, marketplace_id: nil, channel_name: nil, last_updated_after: nil,
  last_updated_before: nil, max_results: nil, pagination_token: nil)
  path = "/externalFulfillment/2024-09-11/shipments"
  params = {
    "locationId" => location_id,
    "marketplaceId" => marketplace_id,
    "channelName" => channel_name,
    "status" => status,
    "lastUpdatedAfter" => last_updated_after,
    "lastUpdatedBefore" => last_updated_before,
    "maxResults" => max_results,
    "paginationToken" => pagination_token,
  }.compact
  parser = -> { ShipmentsResponse }
  get(path, params:, parser:)
end

#process_shipment(shipment_id, operation, body: nil) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Confirm or reject the specified shipment.

Parameters:

  • shipment_id (String) —

    The ID of the shipment you want to confirm or reject.

  • operation (String) —

    The status of the shipment.

  • body (Hash) (defaults to: nil) —

    Information about the shipment and its line items.

  • (String)
  • (String)
  • body: (Hash[untyped, untyped], nil) (defaults to: nil)

Returns:



99
100
101
102
103
104
105
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 99

def process_shipment(shipment_id, operation, body: nil)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}"
  params = {
    "operation" => operation,
  }.compact
  post(path, body:, params:)
end

#retrieve_invoice(shipment_id) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Retrieve invoices for the shipment you specify.

Parameters:

  • shipment_id (String) —

    The ID of the shipment whose invoice you want to retrieve.

  • (String)

Returns:



179
180
181
182
183
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 179

def retrieve_invoice(shipment_id)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}/invoice"
  parser = -> { InvoiceResponse }
  get(path, parser:)
end

#retrieve_shipping_options(shipment_id, package_id) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Get a list of shipping options for a package in a shipment given the shipment's marketplace and channel. If the marketplace and channel have a pre-determined shipping option, then this operation returns an empty response.

Parameters:

  • shipment_id (String) —

    The ID of the shipment to which the package belongs.

  • package_id (String) —

    The ID of the package for which you want to retrieve shipping options.

  • (String)
  • (String)

Returns:



154
155
156
157
158
159
160
161
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 154

def retrieve_shipping_options(shipment_id, package_id)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}/shippingOptions"
  params = {
    "packageId" => package_id,
  }.compact
  parser = -> { ShippingOptionsResponse }
  get(path, params:, parser:)
end

#update_package(shipment_id, package_id, body) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Updates the details about the packages that will be used to fulfill the specified shipment.

Parameters:

  • shipment_id (String) —

    The ID of the shipment to which the package belongs.

  • package_id (String) —

    The ID of the package whose information you want to update.

  • body (Hash) —

    The body of the request.

  • (String)
  • (String)
  • (Hash[untyped, untyped])

Returns:



125
126
127
128
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 125

def update_package(shipment_id, package_id, body)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}/packages/#{percent_encode(package_id)}"
  put(path, body:)
end

#update_package_status(shipment_id, package_id, status: nil, body: nil) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Updates the status of the packages.

Parameters:

  • shipment_id (String) —

    The ID of the shipment to which the package belongs.

  • package_id (String) —

    The ID of the package whose status you want to update.

  • status (String) (defaults to: nil) —

    This field is only used for the Seller Flex program. For the Self Delivery program, package statuses are defined in the body parameter.

  • body (Hash) (defaults to: nil) —

    The body of the request.

  • (String)
  • (String)
  • status: (String, nil) (defaults to: nil)
  • body: (Hash[untyped, untyped], nil) (defaults to: nil)

Returns:



139
140
141
142
143
144
145
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 139

def update_package_status(shipment_id, package_id, status: nil, body: nil)
  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}/packages/#{percent_encode(package_id)}"
  params = {
    "status" => status,
  }.compact
  patch(path, body:, params:)
end

#update_sandbox_shipment(shipment_id, body) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Updates a sandbox shipment on marketplace behalf. Supports status changes, invoice availability, and transport capacity updates.

Parameters:

  • shipment_id (String) —

    The unique identifier of the shipment to update.

  • body (Hash) —

    The request body for updating a sandbox shipment.

  • (String)
  • (Hash[untyped, untyped])

Returns:



74
75
76
77
78
79
# File 'lib/peddler/apis/external_fulfillment_shipments_2024_09_11.rb', line 74

def update_sandbox_shipment(shipment_id, body)
  must_sandbox!

  path = "/externalFulfillment/2024-09-11/shipments/#{percent_encode(shipment_id)}"
  patch(path, body:)
end