Microsoft Azure API Management · Arazzo Workflow

Azure API Management Upsert Product

Version 1.0.0

Find a product by identifier and update it if present, otherwise create it.

1 workflow 1 source API 1 provider
View Spec View on GitHub A2AAI GatewayAPI CenterAPI GatewayAPI ManagementEnterpriseMCPMicrosoft AzureArazzoWorkflows

Provider

microsoft-azure-api-management

Workflows

upsert-product
Upsert a product into an API Management service.
Lists products, checks for a matching identifier, and either updates the matched product description or creates a new product.
3 steps inputs: description, displayName, productId, resourceGroupName, serviceName, subscriptionId outputs: productResourceId, updatedProductResourceId
1
listProducts
Product_ListByService
List existing products so the flow can detect whether the target product identifier already exists.
2
updateProduct
Product_Update
Patch the existing product with an updated description.
3
createProduct
Product_CreateOrUpdate
Create a new product with subscription required when no matching product was found.

Source API Descriptions

Arazzo Workflow Specification

microsoft-azure-api-management-upsert-product-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Azure API Management Upsert Product
  summary: Find a product by identifier and update it if present, otherwise create it.
  description: >-
    Keeps a product definition idempotent. The workflow lists the service's
    products, branches on whether the target product identifier already exists,
    and either patches the existing product or creates a new one with
    subscription and approval settings. 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: azureApiManagementApi
  url: ../openapi/microsoft-azure-api-management-rest-api-openapi.yaml
  type: openapi
workflows:
- workflowId: upsert-product
  summary: Upsert a product into an API Management service.
  description: >-
    Lists products, checks for a matching identifier, and either updates the
    matched product description or creates a new product.
  inputs:
    type: object
    required:
    - subscriptionId
    - resourceGroupName
    - serviceName
    - productId
    - displayName
    properties:
      subscriptionId:
        type: string
        description: The Azure subscription identifier.
      resourceGroupName:
        type: string
        description: The resource group containing the service.
      serviceName:
        type: string
        description: The API Management service name.
      productId:
        type: string
        description: The product identifier to upsert.
      displayName:
        type: string
        description: The product display name.
      description:
        type: string
        description: The product description.
  steps:
  - stepId: listProducts
    description: >-
      List existing products so the flow can detect whether the target product
      identifier already exists.
    operationId: Product_ListByService
    parameters:
    - name: subscriptionId
      in: path
      value: $inputs.subscriptionId
    - name: resourceGroupName
      in: path
      value: $inputs.resourceGroupName
    - name: serviceName
      in: path
      value: $inputs.serviceName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      productCount: $response.body#/count
    onSuccess:
    - name: productExists
      type: goto
      stepId: updateProduct
      criteria:
      - context: $response.body
        condition: $.value[?(@.name == '$inputs.productId')]
        type: jsonpath
    - name: productMissing
      type: goto
      stepId: createProduct
      criteria:
      - context: $response.body
        condition: $.count == 0
        type: jsonpath
  - stepId: updateProduct
    description: >-
      Patch the existing product with an updated description.
    operationId: Product_Update
    parameters:
    - name: subscriptionId
      in: path
      value: $inputs.subscriptionId
    - name: resourceGroupName
      in: path
      value: $inputs.resourceGroupName
    - name: serviceName
      in: path
      value: $inputs.serviceName
    - name: productId
      in: path
      value: $inputs.productId
    requestBody:
      contentType: application/json
      payload:
        properties:
          description: $inputs.description
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      productResourceId: $response.body#/id
    onSuccess:
    - name: done
      type: end
  - stepId: createProduct
    description: >-
      Create a new product with subscription required when no matching product
      was found.
    operationId: Product_CreateOrUpdate
    parameters:
    - name: subscriptionId
      in: path
      value: $inputs.subscriptionId
    - name: resourceGroupName
      in: path
      value: $inputs.resourceGroupName
    - name: serviceName
      in: path
      value: $inputs.serviceName
    - name: productId
      in: path
      value: $inputs.productId
    requestBody:
      contentType: application/json
      payload:
        properties:
          displayName: $inputs.displayName
          description: $inputs.description
          subscriptionRequired: true
          approvalRequired: false
          state: published
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      productResourceId: $response.body#/id
  outputs:
    productResourceId: $steps.createProduct.outputs.productResourceId
    updatedProductResourceId: $steps.updateProduct.outputs.productResourceId