arazzo: 1.0.1
info:
title: Salla Upsert Product by SKU
summary: Find a product by keyword and update it if it exists, otherwise create it.
description: >-
A common catalog synchronization pattern. The workflow searches the
product catalog for an existing product matching a SKU or name keyword and
then branches: when a match is found it updates that product in place, and
when no match is found it creates a new product. Each step spells out its
request inline so the flow can be read and executed without opening the
underlying OpenAPI description.
version: 1.0.0
x-realizes-capability-ids:
- BC-2370.10
x-capability-derivation:
method: 'deterministic join: sourceDescriptions -> per-tag OpenAPI -> tag/capability edge. No classification at this step.'
min_confidence: 0.7
sources:
- capability_id: BC-2370.10
capability_name: Item Master Data Management
spec: salla-products-api-openapi.yml
confidence: 0.75
model: Turbo EA Capabilities by Vincent Verdet — Turbo EA, https://github.com/vincentmakes/turbo-ea-capabilities, CC BY 4.0
sourceDescriptions:
- name: productsApi
url: ../openapi/salla-products-api-openapi.yml
type: openapi
workflows:
- workflowId: upsert-product
summary: Upsert a product into the catalog keyed by a SKU or name keyword.
description: >-
Searches the catalog for a product matching the supplied keyword and either
updates the matched product or creates a new one.
inputs:
type: object
required:
- keyword
- name
- price
- productType
properties:
keyword:
type: string
description: SKU or name fragment used to detect an existing product.
name:
type: string
description: Display name to write to the product.
price:
type: number
description: Price to write to the product.
productType:
type: string
description: Product type (e.g. product, service, digital).
quantity:
type: integer
description: Stock quantity to write to the product.
steps:
- stepId: findProduct
description: >-
Search the catalog for a product whose name or SKU matches the supplied
keyword, returning at most one match.
operationId: listProducts
parameters:
- name: keyword
in: query
value: $inputs.keyword
- name: per_page
in: query
value: 1
successCriteria:
- condition: $statusCode == 200
outputs:
matchedProductId: $response.body#/data/0/id
onSuccess:
- name: productExists
type: goto
stepId: updateExisting
criteria:
- context: $response.body
condition: $.data.length > 0
type: jsonpath
- name: productMissing
type: goto
stepId: createNew
criteria:
- context: $response.body
condition: $.data.length == 0
type: jsonpath
- stepId: updateExisting
description: >-
Update the matched product in place with the supplied attributes.
operationId: updateProduct
parameters:
- name: product_id
in: path
value: $steps.findProduct.outputs.matchedProductId
requestBody:
contentType: application/json
payload:
name: $inputs.name
price: $inputs.price
product_type: $inputs.productType
quantity: $inputs.quantity
successCriteria:
- condition: $statusCode == 200
outputs:
productId: $response.body#/data/id
onSuccess:
- name: done
type: end
- stepId: createNew
description: >-
Create a new product when no existing product matched the keyword.
operationId: createProduct
requestBody:
contentType: application/json
payload:
name: $inputs.name
price: $inputs.price
product_type: $inputs.productType
quantity: $inputs.quantity
successCriteria:
- condition: $statusCode == 201
outputs:
productId: $response.body#/data/id
outputs:
updatedProductId: $steps.updateExisting.outputs.productId
createdProductId: $steps.createNew.outputs.productId
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.