arazzo: 1.0.1
info:
title: SAP Integration Suite Upsert API Proxy
summary: Look up an API proxy by name and update it if it exists, otherwise create it.
description: >-
A common API Management idempotency pattern. The workflow looks up an API
proxy by name and then branches: when the proxy is found it updates the
existing proxy with the supplied target endpoint and metadata, and when it
is not found (a 404) it creates a new proxy instead. Finally it reads the
proxy back to confirm the resulting state. 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: apiProxiesApi
url: ../openapi/sap-integration-suite-api-proxies-api-openapi.yml
type: openapi
workflows:
- workflowId: upsert-api-proxy
summary: Update an API proxy if it exists, otherwise create it, by proxy name.
description: >-
Looks up an API proxy by name and either updates the existing proxy or
creates a new one, then confirms the final state.
inputs:
type: object
required:
- proxyName
- targetEndpoint
properties:
proxyName:
type: string
description: Name of the API proxy to upsert.
proxyTitle:
type: string
description: Display title for the proxy.
description:
type: string
description: Description of the proxy.
basePath:
type: string
description: Base path the proxy is served on.
targetEndpoint:
type: string
description: Backend target endpoint URL the proxy routes to.
version:
type: string
description: API version label for the proxy.
steps:
- stepId: findProxy
description: >-
Look up the API proxy by name. A 200 routes to update; a 404 routes to
create.
operationId: getAPIProxy
parameters:
- name: name
in: path
value: $inputs.proxyName
successCriteria:
- condition: $statusCode == 200 || $statusCode == 404
outputs:
lookupStatus: $statusCode
onSuccess:
- name: proxyExists
type: goto
stepId: updateExisting
criteria:
- condition: $statusCode == 200
- name: proxyMissing
type: goto
stepId: createNew
criteria:
- condition: $statusCode == 404
- stepId: updateExisting
description: Update the existing proxy with the supplied endpoint and metadata.
operationId: updateAPIProxy
parameters:
- name: name
in: path
value: $inputs.proxyName
requestBody:
contentType: application/json
payload:
name: $inputs.proxyName
title: $inputs.proxyTitle
description: $inputs.description
basePath: $inputs.basePath
targetEndpoint: $inputs.targetEndpoint
version: $inputs.version
successCriteria:
- condition: $statusCode == 200
outputs:
updateStatus: $statusCode
onSuccess:
- name: updated
type: goto
stepId: confirmProxy
- stepId: createNew
description: Create a new proxy when no proxy with the supplied name exists.
operationId: createAPIProxy
requestBody:
contentType: application/json
payload:
name: $inputs.proxyName
title: $inputs.proxyTitle
description: $inputs.description
basePath: $inputs.basePath
targetEndpoint: $inputs.targetEndpoint
version: $inputs.version
successCriteria:
- condition: $statusCode == 201
outputs:
createdProxyName: $response.body#/d/name
- stepId: confirmProxy
description: Read the proxy back to confirm its final state after the upsert.
operationId: getAPIProxy
parameters:
- name: name
in: path
value: $inputs.proxyName
successCriteria:
- condition: $statusCode == 200
outputs:
finalTargetEndpoint: $response.body#/d/targetEndpoint
isDeployed: $response.body#/d/isDeployed
outputs:
lookupStatus: $steps.findProxy.outputs.lookupStatus
finalTargetEndpoint: $steps.confirmProxy.outputs.finalTargetEndpoint
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
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. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.