Commerce Layer · Arazzo Workflow

Commerce Layer Create and Ship a Shipment

Version 1.0.0

Create a shipment for an order, mark it ready to ship, then ship it.

1 workflow 1 source API 1 provider
View Spec View on GitHub Headless CommerceComposable CommerceAPI-FirstEcommerceJSON:APIOAuth 2.0Multi-MarketMulti-CurrencyB2CB2BSubscriptionsPromotionsInventoryOrder ManagementCheckoutArazzoWorkflows

Provider

commerce-layer

Workflows

create-and-ship-shipment
Create a shipment, ready it, and ship it.
Creates a shipment for an order, patches it with the documented _ready_to_ship flag, then patches it with the documented _ship flag.
3 steps inputs: accessToken, inventoryStockLocationId, orderId outputs: shipmentId, status
1
createShipment
POST/shipments
Create the shipment for the order from the stock location.
2
markReadyToShip
PATCH/shipments/shipmentId
Toggle the documented _ready_to_ship transition flag on the shipment.
3
shipShipment
PATCH/shipments/shipmentId
Toggle the documented _ship transition flag to dispatch the shipment.

Source API Descriptions

Arazzo Workflow Specification

commerce-layer-create-and-ship-shipment-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Commerce Layer Create and Ship a Shipment
  summary: Create a shipment for an order, mark it ready to ship, then ship it.
  description: >-
    A Commerce Layer end-to-end fulfillment flow. The workflow creates a
    shipment tied to an order and stock location, advances it with the
    documented _ready_to_ship transition flag, and then dispatches it with the
    documented _ship flag. Every step spells out its JSON:API request inline so
    the flow can be read and executed without opening the underlying OpenAPI
    description.
  version: 1.0.0
sourceDescriptions:
- name: coreApi
  url: ../openapi/commerce-layer-core-api-openapi.json
  type: openapi
workflows:
- workflowId: create-and-ship-shipment
  summary: Create a shipment, ready it, and ship it.
  description: >-
    Creates a shipment for an order, patches it with the documented
    _ready_to_ship flag, then patches it with the documented _ship flag.
  inputs:
    type: object
    required:
    - accessToken
    - orderId
    - inventoryStockLocationId
    properties:
      accessToken:
        type: string
        description: Bearer access token for the Commerce Layer organization.
      orderId:
        type: string
        description: The id of the order the shipment belongs to.
      inventoryStockLocationId:
        type: string
        description: The id of the inventory stock location fulfilling the shipment.
  steps:
  - stepId: createShipment
    description: Create the shipment for the order from the stock location.
    operationId: POST/shipments
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: shipments
          relationships:
            order:
              data:
                type: orders
                id: $inputs.orderId
            inventory_stock_location:
              data:
                type: inventory_stock_locations
                id: $inputs.inventoryStockLocationId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      shipmentId: $response.body#/data/id
  - stepId: markReadyToShip
    description: Toggle the documented _ready_to_ship transition flag on the shipment.
    operationId: PATCH/shipments/shipmentId
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: shipmentId
      in: path
      value: $steps.createShipment.outputs.shipmentId
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: shipments
          id: $steps.createShipment.outputs.shipmentId
          attributes:
            _ready_to_ship: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/data/attributes/status
  - stepId: shipShipment
    description: Toggle the documented _ship transition flag to dispatch the shipment.
    operationId: PATCH/shipments/shipmentId
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: shipmentId
      in: path
      value: $steps.createShipment.outputs.shipmentId
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: shipments
          id: $steps.createShipment.outputs.shipmentId
          attributes:
            _ship: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/data/attributes/status
  outputs:
    shipmentId: $steps.createShipment.outputs.shipmentId
    status: $steps.shipShipment.outputs.status