Skip to main content
Related API: This extension modifies the Get Labels operation.
This action manipulates the HTTP request or response after the GetLabels operation occurs in Kibo. GetLabels requests a shipping label for the service type requested and returns a shipment response with the label URL, tracking number, and related package responses. Changes made to the response in this action are applied before Kibo returns the label response to the caller.
Action TypeHTTP
Full Action IDhttp.commerce.catalog.storefront.shipping.getLabels.after
Runs multiple custom functions?Yes

JavaScript File Structure

Action files share the following basic structure:
When you code the custom function for an action, you have access to two arguments: callback—This argument follows the established JavaScript callback pattern: it takes an error as the first argument (or null if there is no error) and a result as the second argument (if required). context—This argument provides the function access to relevant objects and methods that interface with Kibo.

Context: HTTP

The methods and objects documented here are available to this action through the use of the context argument. REST API Operation This action corresponds to the commerce/catalog/storefront/shipping/GetLabels operation. HTTP Request POST api/commerce/catalog/storefront/shipping/request-labels?responseFields={responseFields} Request Body Use context.request.body to read/write the HTTP request body using this action. The request body is a ShipmentRequest containing the shipment, carrier, service type, label format (LASER or THERMAL), signature option, customer references, and related order/shipment identifiers. Response Body Use context.response.body to write the HTTP response body using this action. The response body is a ShipmentResponse containing the shipping total, tracking number, package responses (with label URLs), messages, and an IsSuccessful flag.

Context Objects Available to All HTTP Actions

request

Accesses the current HTTP request. In the case of Before actions, updates can be made to the request before Kibo eCommerce processes it. Example:

response

Accesses the current HTTP response. For both Before and After actions, updates can be made to the response before Kibo eCommerce processes it. Example:

Context Methods Available to All HTTP Actions

request.get

Returns an HTTP header value for the specified header key. Example:
Response:

response.get

Gets a field from the response. Example:
Response:

response.set

Sets the HTTP headers for the response. Example:
Response: N/A

response.set2

Updates a field in the response. Example:
Response: N/A

response.remove

Removes an HTTP header from the response. Example:
Response: N/A

response.redirect

Redirects the incoming URL. Example:
Response: N/A;

response.end

Ends the response so that other actions or Kibo eCommerce logic can run. Also, signals the callback to complete. Example:
Response: N/A

get.resource

Returns the currently persisted value of the requested resource. **Not available for all calls. Example:
Response: N/A

get.resourceStatus

Gets the HTTP resource status. Example:
Response: N/A

items.urlHelper.getUrl

Gets the current URL. Example:

Context Objects Available to All Actions

apiContext

Accesses Kibo eCommerce tenant information. Example:

configuration

Receives a JSON response that contains information about the configuration data set in the Action Management JSON editor. Example: