Skip to main content
Related API: This extension modifies the Update Return Package operation.
This action manipulates the HTTP request or response before the UpdatePackage operation occurs in Kibo.
Action TypeHTTP
Full Action IDhttp.commerce.returns.updatePackage.before
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/returns/packages/updatePackage operation.
HTTP Request PUT api/commerce/returns/{returnId}/packages/{packageId}?responseFields={responseFields} Request Body
Use context.request.body to read/write the HTTP request body using this action.
Response Body
Use context.response.body to write the HTTP response body using this action.

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. *Available only for Storefront HTTP actions. | | query | object | The request query. | | href | string | The request href. | | secure | Boolean | Indicates whether the request uses HTTPS. | | ip | string | The request IP address. | | ips | string | The request secure IP address. | | body | object | The request body of the API operation associated with this action. | 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. *Available only for Storefront HTTP actions. | | viewName | string | The response viewName value. *Available only for Storefront HTTP actions. | | body | object | The response body of the API operation associated with this action. | | status | integer | The response status code. | | message | string | The response message. | | length | integer | The response length. | | type | string | The response type. | 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: