WooCommerce · Arazzo Workflow

WooCommerce Upsert Product Category

Version 1.0.0

Find a product category by slug and create it only if it does not already exist.

1 workflow 1 source API 1 provider
View Spec View on GitHub E-CommerceOpen-SourceOrderProductWordPressArazzoWorkflows

Provider

woocommerce

Workflows

upsert-category
Upsert a product category, creating it only when it is missing.
Searches for an existing product category by name and either reads the matched category or creates a new one when no match exists.
3 steps inputs: categoryDescription, categoryName, categorySlug outputs: categoryId, createdCategoryId
1
findCategory
Search existing product categories for one matching the supplied name, returning at most one result.
2
getExisting
Read the matched category to confirm its current name and slug.
3
createNew
Create a new product category when no existing category matched the name.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: WooCommerce Upsert Product Category
  summary: Find a product category by slug and create it only if it does not already exist.
  description: >-
    A common catalog maintenance pattern. The workflow searches existing product
    categories for one whose name matches the supplied value, then branches:
    when a match is found it reads the existing category, and when no match is
    found it creates a new category. Every step spells out its request inline so
    the flow can be read and executed without opening the underlying OpenAPI
    description.
  version: 1.0.0
sourceDescriptions:
- name: productCategoriesApi
  url: ../openapi/woocommerce-product-categories-api-openapi.yml
  type: openapi
workflows:
- workflowId: upsert-category
  summary: Upsert a product category, creating it only when it is missing.
  description: >-
    Searches for an existing product category by name and either reads the
    matched category or creates a new one when no match exists.
  inputs:
    type: object
    required:
    - categoryName
    properties:
      categoryName:
        type: string
        description: Name of the category to find or create.
      categorySlug:
        type: string
        description: Optional URL-friendly slug to use when creating the category.
      categoryDescription:
        type: string
        description: Optional description to use when creating the category.
  steps:
  - stepId: findCategory
    description: >-
      Search existing product categories for one matching the supplied name,
      returning at most one result.
    operationId: listProductCategories
    parameters:
    - name: search
      in: query
      value: $inputs.categoryName
    - name: per_page
      in: query
      value: 1
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      matchedCategoryId: $response.body#/0/id
    onSuccess:
    - name: categoryExists
      type: goto
      stepId: getExisting
      criteria:
      - context: $response.body
        condition: $.length > 0
        type: jsonpath
    - name: categoryMissing
      type: goto
      stepId: createNew
      criteria:
      - context: $response.body
        condition: $.length == 0
        type: jsonpath
  - stepId: getExisting
    description: >-
      Read the matched category to confirm its current name and slug.
    operationId: getProductCategory
    parameters:
    - name: id
      in: path
      value: $steps.findCategory.outputs.matchedCategoryId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      categoryId: $response.body#/id
      categoryName: $response.body#/name
    onSuccess:
    - name: done
      type: end
  - stepId: createNew
    description: >-
      Create a new product category when no existing category matched the name.
    operationId: createProductCategory
    requestBody:
      contentType: application/json
      payload:
        name: $inputs.categoryName
        slug: $inputs.categorySlug
        description: $inputs.categoryDescription
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      categoryId: $response.body#/id
      categoryName: $response.body#/name
  outputs:
    categoryId: $steps.getExisting.outputs.categoryId
    createdCategoryId: $steps.createNew.outputs.categoryId

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/woocommerce-upsert-category-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

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.

A second provider on the same verified email joins the account you already have.