Commerce Layer · Arazzo Workflow

Commerce Layer Create SKU, Price It, and Read SKU Back

Version 1.0.0

Create a SKU, create a price for it in a price list, then retrieve the SKU.

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-sku-price-and-get
Create a SKU, price it, and read the SKU back.
Creates a SKU, creates a price for it in a price list, then retrieves the SKU to confirm its persisted attributes.
3 steps inputs: accessToken, amountCents, code, name, priceListId, shippingCategoryId outputs: priceId, skuId
1
createSku
POST/skus
Create the SKU under the supplied shipping category.
2
createPrice
POST/prices
Create a price for the SKU inside the supplied price list.
3
getSku
GET/skus/skuId
Retrieve the SKU to confirm its persisted attributes.

Source API Descriptions

Arazzo Workflow Specification

commerce-layer-create-sku-price-and-get-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Commerce Layer Create SKU, Price It, and Read SKU Back
  summary: Create a SKU, create a price for it in a price list, then retrieve the SKU.
  description: >-
    The full Commerce Layer catalog onboarding flow. The workflow creates a SKU
    under a shipping category, creates a price for that SKU inside a price list,
    and then retrieves the SKU so the caller can confirm its persisted
    attributes. 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-sku-price-and-get
  summary: Create a SKU, price it, and read the SKU back.
  description: >-
    Creates a SKU, creates a price for it in a price list, then retrieves the
    SKU to confirm its persisted attributes.
  inputs:
    type: object
    required:
    - accessToken
    - shippingCategoryId
    - priceListId
    - code
    - name
    - amountCents
    properties:
      accessToken:
        type: string
        description: Bearer access token for the Commerce Layer organization.
      shippingCategoryId:
        type: string
        description: The id of the shipping category for the SKU.
      priceListId:
        type: string
        description: The id of the price list the price belongs to.
      code:
        type: string
        description: The unique SKU code.
      name:
        type: string
        description: The SKU display name.
      amountCents:
        type: integer
        description: The price amount in cents.
  steps:
  - stepId: createSku
    description: Create the SKU under the supplied shipping category.
    operationId: POST/skus
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: skus
          attributes:
            code: $inputs.code
            name: $inputs.name
          relationships:
            shipping_category:
              data:
                type: shipping_categories
                id: $inputs.shippingCategoryId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      skuId: $response.body#/data/id
  - stepId: createPrice
    description: Create a price for the SKU inside the supplied price list.
    operationId: POST/prices
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: prices
          attributes:
            sku_code: $inputs.code
            amount_cents: $inputs.amountCents
          relationships:
            price_list:
              data:
                type: price_lists
                id: $inputs.priceListId
            sku:
              data:
                type: skus
                id: $steps.createSku.outputs.skuId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      priceId: $response.body#/data/id
  - stepId: getSku
    description: Retrieve the SKU to confirm its persisted attributes.
    operationId: GET/skus/skuId
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: skuId
      in: path
      value: $steps.createSku.outputs.skuId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      code: $response.body#/data/attributes/code
      name: $response.body#/data/attributes/name
  outputs:
    skuId: $steps.createSku.outputs.skuId
    priceId: $steps.createPrice.outputs.priceId