Add or update a workflow definition variable value

Add or update the value of a workflow definition variable. To add or update the value of a workflow definition variable, you must register with SimWorkflow and have a valid Personal Access Token to authenticate requests.

Request syntax

PUT /workflow-definitions/${WORKFLOW_DEFINITION_ID}/variables/${VARIABLE_NAME} HTTP/1.1
Host: api.simworkflow.com
Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}
Content-Type: application/json
${VARIABLE_VALUE}

Request headers

Authorization

Bearer ${PERSONAL_ACCESS_TOKEN}

Content-Type

application/json

Response syntax

HTTP/1.1 200 OK

Response elements

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

Errors

See also general errors.

cURL example: update a workflow definition variable value

PUT /workflow-definitions/0NRnuLkcXGPHmtV5qLUErk/variables/current_year

curl \
--request "PUT" \
--header "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--url "https://api.simworkflow.com/workflow-definitions/0NRnuLkcXGPHmtV5qLUErk/variables/current_year" \
--data '2024'

RESPONSE

HTTP/1.1 200 OK

cURL example: add a workflow definition variable with invalid variable name

PUT /workflow-definitions/0NRnuLkcXGPHmtV5qLUErk/variables/invalid:name

curl \
--request "PUT" \
--header "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--url "https://api.simworkflow.com/workflow-definitions/0NRnuLkcXGPHmtV5qLUErk/variables/invalid:name" \
--data '"string"'

RESPONSE

HTTP/1.1 400 Bad Request
{
  "status": 400,
  "error": "Bad Request",
  "fieldErrors": {
    "variable.key": {
      "field": "variable.key",
      "message": "Variable key must be one line, with no spaces, using only letters, numbers, or _",
      "value": null
    }
  }
}