Schedules
The Schedule API enables automated creation, retrieval, updating, and deletion of workflow schedules using cron or rate expressions, supporting full lifecycle management via REST endpoints.
Overview
By using this API you can create the auto schedule to run a workflow.Once API is triggered by a request the corresponding lambda will process the request then sends data to entity: Schedule which will stores the data to DynamoDB & do the operations mentioned below.
Operations:
Schedule API will do CRUD operations on Schedules.Create:
- API will be creating new schedule data in DynamoDB then create a schedule in event bridge.
 - Operation method: ‘POST’.
 - Have to send start and End date in UTC timings.
 - URL: 0/v1/schedules/
 
Request details
| field Name | type | cardinality | Enumerations | sample | Comments/Description | 
|---|---|---|---|---|---|
| workflowId | string | Mandatory | WORKFLOW-8984f10d15e643c386307773dbf***** | Unique Identification for workflow | |
| expression | string | Mandatory | cron(0/3 * ? * MON-FRI *) 
rate(5 minutes) | 
Expression describes about the cron or rate job for the schedule | 
|
scheduleName | 
string | 
Mandatory | 
 | 
TN_Schedule_1 | 
For specifying name of the schedule. | 
startDate | 
Date | 
Optional | 
2023-08-25T18:30:00.000Z | 
Date and time to specify when to start the schedule | 
|
endDate | 
Date | 
Optional | 
2023-08-29T18:30:00.000Z | 
Date and time to specify when to end the schedule | 
|
timezone | 
string | 
Optional | 
Canada/Central | 
This field can be utilized to mention which are time zone the schedule has to run . | 
Read:
Here we have three ways to get the schedules :
listSchedules
- This Lambda will fetch all the schedule related to the tenant from the DynamoDB.
 - URL:0/v1/schedules/
 
listSchedulesByWorkflow
- This lambda expects workflowId in request then fetch schedules related to specific workflow from the DynamoDB.
 - URL:0/v1/schedules/by-workflow/{workflowId}
 
Request details:
| field Name | type | cardinality | Enumerations | sample | Comments/Description | 
|---|---|---|---|---|---|
| workflowId | string | Mandatory | WORKFLOW-8984f10d15e643c386307773dbf***** | Unique Identification for workflow | 
getSchedule
- This lambda expects entityId(i.e. scheduleId) in the request then fetch specific schedule from the DynamoDB.
 - URL: 0/v1/schedules/{entityId}
 
Request Details:
| field Name | type | cardinality | Enumerations | sample | Comments/Description | 
|---|---|---|---|---|---|
| scheduleId | |||||
| {entityId} | string | Mandatory | SCHEDULE-98e98083c3474d03a0c21ab86833d*** | Unique Identification for Schedule once created | 
Update:
- API updates the existing schedule data in the EVENT BIRDGE then updates the record in DynamoDB.
 - Operation method: ‘PATCH’ .
 - URL: 0/v1/schedules/{entityId}
 
Request details:
| field Name | type | cardinality | Enumerations | sample | Comments/Description | 
|---|---|---|---|---|---|
| scheduleId | |||||
| {entityId} | string | Mandatory | SCHEDULE-98e98083c3474d03a0c21ab86833d*** | Unique Identification for Schedule once created | |
| expression | string | Mandatory | cron(0/3 * ? * MON-FRI *) | 
rate(5 minutes) | Expression describes about the cron or rate job for the schedule |
Delete:
- This lambda will expects schedule Id in input and deletes the corresponding schedule data from EVENT BIRDGE then same record from DynamoDB .
 - Operation method: ‘DELETE’ .
 - URL: 0/v1/schedules/{entityId}
 
Request details:
| field Name | type | cardinality | Enumerations | sample | Comments/Description | 
|---|---|---|---|---|---|
| scheduleId | |||||
| {entityId} | string | Mandatory | SCHEDULE-98e98083c3474d03a0c21ab86833d*** | Unique Identification for Schedule once created | 
Sample Messages:
Create
Create sample request:
**{
	"workflowId": "WORKFLOW-dc017824c2da4668ba09471d050*****",
	"expression": "cron(0 1 ? * * *)",
	"scheduleName": "TN_SCHEDULE_1",
	"startDate": "2023-08-24T18:30:00.000Z",
	"endDate": "2023-09-29T18:30:00.000Z",
	"timezone": "Canada/Central"
}**
Create Sample response:{
    "endDate": "2023-09-29T18:30:00.000Z",
    "scheduleName": "TN_SCHEDULE_1",
    "entity": "Schedule",
    "scheduleAlias": "TN_SCHEDULE_1",
    "created": "2023-08-24T10:19:01.455Z",
    "active": true,
    "modified": "2023-08-24T10:19:01.455Z",
    "workflowId": "WORKFLOW-dc017824c2da4668ba09471d0504****",
    "userId": "USER-f3ac58bd3c0d46a2bab8397bb2fa****",
    "startDate": "2023-08-24T18:30:00.000Z",
    "expression": "cron(0 1 ? * * *)",
    "scheduleId": "SCHEDULE-d887715d43414f7392b281f034df****",
    "timezone": "Canada/Central",
    "tenantId": "TENANT-b87c1cdf79344552b568d069a186****"
}
Read
listSchedules sample request:{}
listSchedules sample response:{
    "count": 2,
    "items": [
        {
            "endDate": "2023-08-23T07:25:00Z",
            "scheduleName": "TN_Schedule_20230823_3",
            "entity": "Schedule",
            "scheduleAlias": "TN_Schedule_20230823_3",
            "created": "2023-08-23T07:01:56.843Z",
            "active": true,
            "modified": "2023-08-23T07:01:56.843Z",
            "workflowId": "WORKFLOW-dc017824c2da4668ba09471d0504b***",
            "userId": "USER-f3ac58bd3c0d46a2bab8397bb2fa****",
            "startDate": "2023-08-23T07:05:00Z",
            "expression": "cron(0/7 * ? * MON-FRI *)",
            "timezone": "Asia/Calcutta",
            "scheduleId": "SCHEDULE-58b0ab97c5ea490e997b8780df9cc****",
            "tenantId": "TENANT-b87c1cdf79344552b568d069a18*****"
        },
        {
            "endDate": "2023-09-29T18:30:00.000Z",
            "scheduleName": "SCHEDULE",
            "entity": "Schedule",
            "scheduleAlias": "SCHEDULE",
            "created": "2023-08-24T09:44:57.722Z",
            "active": true,
            "modified": "2023-08-24T09:44:57.722Z",
            "workflowId": "WORKFLOW-dc017824c2da4668ba09471d0504****",
            "userId": "USER-f3ac58bd3c0d46a2bab8397bb2f*****",
            "startDate": "2023-09-24T18:30:00.000Z",
            "expression": "cron(0 0 ? * * *)",
            "timezone": "Canada/Central",
            "scheduleId": "SCHEDULE-60f9401681eb4556a6916894fd5*****",
            "tenantId": "TENANT-b87c1cdf79344552b568d069a186****"
        }
    ],
    "scannedCount": 2,
    "queryCount": 1
}
listSchedulesByWorkflow sample request:{}
listSchedulesByWorkflow sample response:{
    "count": 2,
    "items": [
        {
            "endDate": "2023-08-23T12:20:00Z",
            "scheduleName": "TN_Schedule_20230823_2",
            "entity": "Schedule",
            "scheduleAlias": "TN_Schedule_20230823_2",
            "created": "2023-08-23T06:31:15.178Z",
            "active": true,
            "modified": "2023-08-23T06:31:15.178Z",
            "userId": "USER-f3ac58bd3c0d46a2bab8397bb2fa0***",
            "workflowId": "WORKFLOW-dc017824c2da4668ba09471d0504b***",
            "startDate": "2023-08-23T12:05:00Z",
            "expression": "cron(0/5 * ? * MON-FRI *)",
            "scheduleId": "SCHEDULE-ff6c580abd814db681d5b7724f40a***",
            "tenantId": "TENANT-b87c1cdf79344552b568d069a1862***"
        },
        {
            "endDate": "2023-08-23T07:25:00Z",
            "scheduleName": "TN_Schedule_20230823_3",
            "entity": "Schedule",
            "scheduleAlias": "TN_Schedule_20230823_3",
            "created": "2023-08-23T07:01:56.843Z",
            "active": true,
            "modified": "2023-08-23T07:01:56.843Z",
            "userId": "USER-f3ac58bd3c0d46a2bab8397bb2fa0****",
            "workflowId": "WORKFLOW-dc017824c2da4668ba09471d0504***",
            "startDate": "2023-08-23T07:05:00Z",
            "expression": "cron(0/7 * ? * MON-FRI *)",
            "scheduleId": "SCHEDULE-58b0ab97c5ea490e997b8780df9cc****",
            "timezone": "Asia/Calcutta",
            "tenantId": "TENANT-b87c1cdf79344552b568d069a1862***"
        }
    ],
    "scannedCount": 2,
    "queryCount": 1
}
getSchedule sample request:{}
getSchedule sample response:{
    "scheduleName": "TN_Schedule_1",
    "entity": "Schedule",
    "scheduleAlias": "TN_Schedule_1",
    "created": "2023-03-13T07:30:26.098Z",
    "active": true,
    "modified": "2023-03-13T07:30:26.098Z",
    "workflowId": "WORKFLOW-32be5cb6c66e4fe8843ac5b8c2cf1e***",
    "userId": "USER-c96c306639464c5692e7bf0e7890***",
    "expression": "rate(5 minutes)",
    "scheduleId": "SCHEDULE-db521619d2f241048c6142cf6f284***",
    "tenantId": "TENANT-a7ecd4b2778d4e62be2447c03fa54***"
}
Update
Update sample request:
{
    "expression": "rate(10 minutes)"
}
Update sample response:
{
    "scheduleName": "TN_Schedule_1",
    "entity": "Schedule",
    "scheduleAlias": "TN_Schedule_1",
    "created": "2023-03-13T07:31:44.575Z",
    "active": true,
    "modified": "2023-03-14T06:28:48.016Z",
    "workflowId": "WORKFLOW-8984f10d15e643c386307773dbf98***",
    "userId": "USER-c96c306639464c5692e7bf0e78900***",
    "expression": "rate(59 minutes)",
    "scheduleId": "SCHEDULE-eaa4f6af9dbd469a915e2822bdbd3***",
    "tenantId": "TENANT-a7ecd4b2778d4e62be2447c03fa54***"
}
Delete:
Delete sample request :{}
Delete sample response:{
	status Code:202,
	body: Accepted
}
More Details:
BitBucket URL: https://bitbucket.org/vincesoftware/vl-sst-api-schedules/src/dev/