Update a workflow definition
Update a workflow definition. To update a workflow definition, you must register with SimWorkflow and have a valid Personal Access Token to authenticate requests. Anonymous requests are never allowed to update workflow definitions.
Request syntax
PUT /workflow-definitions/${WORKFLOW_DEFINITION_ID} HTTP/1.1
Host: api.simworkflow.com
Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}
Content-Type: application/json
${WORKFLOW_DEFINITION}
Request headers
Authorization |
|
---|---|
Content-Type |
|
Request body
The Workflow definition JSON object
Response syntax
HTTP/1.1 200 OK
Response elements
If the action is successful, the service sends back an HTTP 200 response.
Errors
HTTP status code |
Description |
---|---|
400 |
When the workflow definition object is not valid. |
See also general errors.
cURL example: update a valid workflow definition
PUT /workflow-definitions/0NRnuLkcXGPHmtV5qLUErk
curl \
--request "PUT" \
--header "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--url "https://api.simworkflow.com/workflow-definitions/0NRnuLkcXGPHmtV5qLUErk" \
--data '{
"name": "Update Customer Details",
"startTask": "Lookup Customer Details",
"tasks": {
"Lookup Customer Details": {
"type": "Parallel",
"branches": [
{
"startTask": "Lookup Address",
"tasks": {
"Lookup Address": {
"type": "Http",
"httpRequest": {
"url": "https://nominatim.openstreetmap.org/search?addressdetails=1&format=json&q=Melbourne"
},
"end": true
}
}
},
{
"startTask": "Lookup Phone Number",
"tasks": {
"Lookup Phone Number": {
"type": "Http",
"credentials": "CredentialsId",
"httpRequest": {
"url": "https://lookups.twilio.com/v2/PhoneNumbers/+15108675310?Fields=line_type_intelligence"
},
"end": true
}
}
}
],
"nextTask": "Join Task"
},
"Join Task": {
"type": "Terminate",
"terminationStatus": "Completed"
}
}
}'
RESPONSE
HTTP/1.1 200 OK
cURL example: workflow definition does not exist
PUT /workflow-definitions/6FE3mVtZSX1NWzTdVAOc4n
curl \
--request "PUT" \
--header "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--url "https://api.simworkflow.com/workflow-definitions/6FE3mVtZSX1NWzTdVAOc4n" \
--data '{
"name": "Customer Details",
"startTask": "Lookup Customer Details",
"tasks": {
"Lookup Customer Details": {
"type": "Parallel",
"branches": [
{
"startTask": "Lookup Address",
"tasks": {
"Lookup Address": {
"type": "Http",
"httpRequest": {
"url": "https://nominatim.openstreetmap.org/search?addressdetails=1&format=json&q=Melbourne"
},
"end": true
}
}
},
{
"startTask": "Lookup Phone Number",
"tasks": {
"Lookup Phone Number": {
"type": "Http",
"credentials": "CredentialsId",
"httpRequest": {
"url": "https://lookups.twilio.com/v2/PhoneNumbers/+15108675310?Fields=line_type_intelligence"
},
"end": true
}
}
}
],
"nextTask": "Join Task"
}
}
}'
RESPONSE
HTTP/1.1 404 Not Found
{
"status": 404,
"error": "Not Found",
"message": "The resource you tried cannot be found."
}