# Create a Workflow
API call format
POST /workflows/<workflow_body>
Description
Workflow extends existing blueprint by adding more optional settings in JSON formats like schedule,subscriptions,inputWhitelistCIDRs and region. Actually we are constructing a new JSON by adding these new settings to the existing blueprint JSON.
Precondition:
- Authorization token is needed.
- Mandatory elements (should be specified):
- <blueprint_id> - valid blueprint id. Take a bluprint id using Blueprint List API call.
- <region_string> - valid region string.
- <stop_date_time> - valid dates in ISO 8601 format for schedule section if included.
- <start_date_time> - valid dates in ISO 8601 format for schedule section if included.
- We have existing valid blueprint with known JSON body.
Postcondition:
- On success response code should be 200
- On success the created workflow id will be returned.
- On failure an error will be returned with the right error code and description.
Blueprint Example:
{
"blueprint":{<blueprint_content_json_from_previous_call>},
//schedule dates should be in ISO 8601 format(2019-04-05T11:52:26+00:00)
"schedule": {
"stopDateTime": "<stop_date_time>",
"startDateTime": "<startDateTime>",
"startDateTimeShiftMinutes": 0
},
"subscriptions": [
{
"owner": "string",
"protocol": "string",
"endpoint": "string",
"subscriptionArn": "string",
"topicArn": "string"
}
],
"inputWhitelistCIDRs": [
"string"
],
"region": "<region_string>"
}
Hints:
Acceptable values for regions are: "ap-northeast-1"(Asia Pac/ific (Tokyo)"), "ap-northeast-1" etc. We could get available regions for the current user using another API call GET /regions with no parameters.
Response body will be similar to this:
{
"items": [
{
"name": "ap-northeast-1",
"description": "Asia Pacific (Tokyo)"
}
]
}
Example:
To create a new workflow we use POST /workflows/{<WorkflowBody>} where WorkflowBody is the JSON we Estructed above `example:
[Request] POST https://<base_api_url>/workflows {<WorkflowBody>}
[Request Headers] {"Content-Type":"application/json","Accept":"application/json","Authorization":"<IdToken>"}
[Page] https://<base_api_url>/workflows
[Response] 200
[Request Cookies] []
[Response Headers] {"Content-Type":["application/json"],.....]}
[Response] {"id":"<workflow_id>"}
We receive unique identifier of the created workflow. We shall preserve this <workflow_id> for the next API calls.