Get a workflow definition

Get a workflow definition. To get a workflow definition, you must register with SimWorkflow and have a valid Personal Access Token to authenticate requests. Anonymous requests are never allowed to get workflow definitions.

Request syntax

GET /workflow-definitions/${WORKFLOW_DEFINITION_ID} HTTP/1.1
Host: api.simworkflow.com
Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}

Request headers

Authorization

Bearer ${PERSONAL_ACCESS_TOKEN}

Response syntax

HTTP/1.1 200 OK
${WORKFLOW_DEFINITION}

Response elements

If the action is successful, the service sends back an HTTP 200 response.

The response returns the body contains the workflow definition JSON.

Errors

See also general errors.

cURL example: get a workflow definition

GET /workflow-definitions/0NRnuLkcXGPHmtV5qLUErk

curl \
--request "GET" \
--header "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
--url "https://api.simworkflow.com/workflow-definitions/0NRnuLkcXGPHmtV5qLUErk"

RESPONSE

HTTP/1.1 200 OK
{
  "name": "Update Customer Details",
  "description": null,
  "startTask": "Lookup Customer Details",
  "tasks": {
    "Join Task": {
      "type": "Terminate",
      "description": null,
      "inputParameters": null,
      "retry": null,
      "terminationStatus": "Completed",
      "workflowOutput": null
    },
    "Lookup Customer Details": {
      "type": "Parallel",
      "description": null,
      "inputParameters": null,
      "retry": null,
      "branches": [
        {
          "startTask": "Lookup Address",
          "tasks": {
            "Lookup Address": {
              "type": "Http",
              "description": null,
              "inputParameters": null,
              "retry": null,
              "nextTask": null,
              "end": true,
              "credentials": null,
              "httpRequest": {
                "url": "https://nominatim.openstreetmap.org/search?addressdetails=1&format=json&q=Melbourne",
                "method": null,
                "headers": null,
                "body": null
              },
              "connectionTimeoutSeconds": null,
              "readTimeoutSeconds": null
            }
          }
        },
        {
          "startTask": "Lookup Phone Number",
          "tasks": {
            "Lookup Phone Number": {
              "type": "Http",
              "description": null,
              "inputParameters": null,
              "retry": null,
              "nextTask": null,
              "end": true,
              "credentials": null,
              "httpRequest": {
                "url": "https://lookups.twilio.com/v2/PhoneNumbers/+15108675310?Fields=line_type_intelligence",
                "method": null,
                "headers": null,
                "body": null
              },
              "connectionTimeoutSeconds": null,
              "readTimeoutSeconds": null
            }
          }
        }
      ],
      "nextTask": "Join Task"
    }
  },
  "timeoutSeconds": null,
  "failureWorkflow": null
}

cURL example: get a workflow definition does not exist

GET /workflow-definitions/6FE3mVtZSX1NWzTdVAOc4n

curl \
--request "GET" \
--header "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
--url "https://api.simworkflow.com/workflow-definitions/6FE3mVtZSX1NWzTdVAOc4n"

RESPONSE

HTTP/1.1 404 Not Found
{
  "status": 404,
  "error": "Not Found",
  "message": "The resource you tried cannot be found."
}