Scheduled Tasks can be accessed through this API using GET. This API can also run and cancel scheduled tasks based on task id and other parameters.
Base URL for Scheduled Tasks REST API
Each function returns a JSON scheduled task object. The scheduled task object has these attributes:
Attributes | Type | Description |
---|---|---|
taskId | Long | The task id of the scheduled task. |
status | String | The status of the scheduled task. |
scheduleDate | String | This is the scheduled date to run the scheduled task. |
environmentId | Long | The environment Id of the scheduled task. |
requestType | String | The request type of the scheduled task. The request type can be a step, gate, application, or project request. |
flexFields | List<FlexField> | The list of flex fields for the scheduled task. |
Each scheduled task can be one of four different types: Step, Stage, Application, and Project.
Step Scheduled Task
Attributes | Type | Description |
---|---|---|
snapshotId | Long | The snapshot id of the step scheduled task. |
pipelineName | String | The pipeline name of the step scheduled task. |
environmentName | String | The environment name of the step scheduled task. |
stepName | String | The step name of the step scheduled task. |
releaseName | String | The release name of the step scheduled task. |
releaseId | Long | The release Id of the step scheduled task. |
snapshotName | String | The snapshot name of the step scheduled task. |
pipelineStageStepExecId | Long | The pipeline stage step execution Id of the step scheduled task. |
Gate Scheduled Task
Attributes | Type | Description |
---|---|---|
snapshotId | Long | The snapshot id of the gate scheduled task. |
pipelineName | String | The pipeline name of the gate scheduled task. |
environmentName | String | The environment name of the gate scheduled task. |
gateName | String | The gate name of the gate scheduled task. |
releaseName | String | The release name of the gate scheduled task. |
releaseId | Long | The release Id of the gate scheduled task. |
snapshotName | String | The snapshot name of the gate scheduled task. |
pipelineStageGateExecId | Long | The pipeline stage gate execution Id of the gate scheduled task. |
Application Scheduled Task
Attributes | Type | Description |
---|---|---|
applicationId | Long | The application Id of the application scheduled task. |
applicationName | String | The application name of the application scheduled task. |
folderVersionName | String | The folder version name of the application scheduled task. |
folderRequestId | Long | The folder request Id of the application scheduled task. |
Project Scheduled Task
Attributes | Type | Description |
---|---|---|
projectId | Long | The project Id of the project scheduled task. |
projectName | String | The project name of the project scheduled task. |
projectVersionName | String | The project version name of the project scheduled task. |
workflowRequestId | Long | The workflow request Id of the project scheduled task. |
GET
GET by TaskId
This GET service will find a scheduled task with the given task Id and return the JSON representation of the object.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
Id | URL | Yes | This is a URL parameter for the Id which is used to find and return a scheduled task. |
Example
If we had a scheduled task in our database with an Id of 10000 and had the following attributes
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 576267, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
When we run a GET request at the following URL
http://host:port/flexdeploy/rest/tasks/scheduled/10000
The GET request would return the following JSON scheduled task object
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 576267, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
GET (Using Query Parameters)
This GET service will return a list of scheduled tasks in the form of JSON objects based on a query parameter for the display name. Scheduled tasks are only returned if they contain the specified parameter. If no query parameters are given this request will return the entire list of scheduled tasks.
API URLs
http://host:port/flexdeploy/rest/tasks/scheduled?
Append the following character sequences to the above URL to specify Query parameters.
workflowRequestId = {workflowRequestId}
folderRequestId = {folderRequestId}
pipelineStageGateExecId = {pipelineStageGateExecId}
pipelineStageStepExecId = {pipelineStageStepExecId}
projectId = {projectId}
applicationId = {applicationId}
environmentId = {environmentId}
Examples:
To return all of the scheduled tasks:
http://host:port/flexdeploy/rest/tasks/scheduled
To search by project Id only:
http://host:port/flexdeploy/rest/tasks/scheduled?projectid=11001
The query parameters are not case sensitive. Searching by name=EXAMPLE is the same as searching by name=example.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
workflowRequestId | URL | No | This is a URL query parameter for the workflow request Id which is used to search the scheduled tasks. |
folderRequestId | URL | No | This is a URL query parameter for the folder request Id which is used to search the scheduled tasks. |
pipelineStageGateExecId | URL | No | This is a URL query parameter for the pipeline stage gate execution Id which is used to search the scheduled tasks. |
pipelineStageStepExecId | URL | No | This is a URL query parameter for the pipeline stage step execution Id which is used to search the scheduled tasks. |
projectId | URL | No | This is a URL query parameter for the project Id which is used to search the scheduled tasks. |
applicationId | URL | No | This is a URL query parameter for the application Id which is used to search the scheduled tasks. |
environmentId | URL | No | This is a URL query parameter for the environment Id which is used to search the scheduled tasks. |
Example
If we had a scheduled task in our database with the following attributes
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
When we run a GET request at the following URL
http://host:port/flexdeploy/rest/tasks/scheduled?projectid=10002
The GET request would return the following JSON scheduled task object
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
Run Now By TaskId
This PUT service will run a scheduled task with the given Id.
Parameters
Attributes | Type | Required | Description |
---|---|---|---|
Id | Long | Yes | The Id that is used to run a scheduled task with the same scheduled task Id. |
Example
If we had a scheduled task in our database with the following attributes
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 576267, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
When we run a PUT request at the following URL
http://host:port/flexdeploy/rest/tasks/scheduled/runnow/14332
The PUT request would run the scheduled task and return the following JSON scheduled task object
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 576267, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "APPROVED" }
Run Now using Query Parameters
This PUT service will run a scheduled task with the given attributes.
API URLs
http://host:port/flexdeploy/rest/tasks/scheduled/runnow?
Append the following character sequences to the above URL to specify Query parameters.
workflowRequestId = {workflowRequestId}
folderRequestId = {folderRequestId}
pipelineStageGateExecId = {pipelineStageGateExecId}
pipelineStageStepExecId = {pipelineStageStepExecId}
projectId = {projectId}
applicationId = {applicationId}
environmentId = {environmentId}
Returned Tasks
Only one scheduled task can be ran at a time. If more than one task matches the query parameters an exception will be thrown.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
workflowRequestId | URL | No | This is a URL query parameter for the workflow request Id which is used to search the scheduled tasks. |
folderRequestId | URL | No | This is a URL query parameter for the folder request Id which is used to search the scheduled tasks. |
pipelineStageGateExecId | URL | No | This is a URL query parameter for the pipeline stage gate execution Id which is used to search the scheduled tasks. |
pipelineStageStepExecId | URL | No | This is a URL query parameter for the pipeline stage step execution Id which is used to search the scheduled tasks. |
projectId | URL | No | This is a URL query parameter for the project Id which is used to search the scheduled tasks. |
applicationId | URL | No | This is a URL query parameter for the application Id which is used to search the scheduled tasks. |
environmentId | URL | No | This is a URL query parameter for the environment Id which is used to search the scheduled tasks. |
Example
If we had a scheduled task in our database with the following attributes
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
When we run a PUT request at the following URL
http://host:port/flexdeploy/rest/tasks/scheduled/runnow?projectid=10002
The PUT request would run the scheduled task and return the following JSON scheduled task object
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "APPROVED" }
Cancel By TaskId
This PUT service will reject a scheduled task with the given Id.
Parameters
Attributes | Type | Required | Description |
---|---|---|---|
Id | Long | Yes | The Id that is used to cancel a scheduled task with the same task Id. |
Example
If we had a scheduled task in our database with the following attributes
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
When we run a PUT request at the following URL
http://host:port/flexdeploy/rest/tasks/scheduled/cancel/14332
The PUT request would cancel the scheduled task and return the following JSON scheduled task object
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "REJECTED" }
Cancel using Query Parameters
This PUT service will cancel a scheduled task with the given attributes.
API URLs
http://host:port/flexdeploy/rest/tasks/scheduled/cancel?
Append the following character sequences to the above URL to specify Query parameters.
workflowRequestId = {workflowRequestId}
folderRequestId = {folderRequestId}
pipelineStageGateExecId = {pipelineStageGateExecId}
pipelineStageStepExecId = {pipelineStageStepExecId}
projectId = {projectId}
applicationId = {applicationId}
environmentId = {environmentId}
Returned Tasks
Only one scheduled task can be canceled at a time. If more than one task matches the query parameters an exception will be thrown.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
workflowRequestId | URL | No | This is a URL query parameter for the workflow request Id which is used to search the scheduled tasks. |
folderRequestId | URL | No | This is a URL query parameter for the folder request Id which is used to search the scheduled tasks. |
pipelineStageGateExecId | URL | No | This is a URL query parameter for the pipeline stage gate execution Id which is used to search the scheduled tasks. |
pipelineStageStepExecId | URL | No | This is a URL query parameter for the pipeline stage step execution Id which is used to search the scheduled tasks. |
projectId | URL | No | This is a URL query parameter for the project Id which is used to search the scheduled tasks. |
applicationId | URL | No | This is a URL query parameter for the application Id which is used to search the scheduled tasks. |
environmentId | URL | No | This is a URL query parameter for the environment Id which is used to search the scheduled tasks. |
Example
If we had a scheduled task in our database with the following attributes
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "PENDING" }
When we run a PUT request at the following URL
http://host:port/flexdeploy/rest/tasks/scheduled/cancel?projectid=10002
The PUT request would cancel the scheduled task and return the following JSON scheduled task object
{ "projectVersionName": "1.0.11", "projectName": "Scheduled Tasks Project", "workflowRequestId": 656423, "projectId": 10002, "scheduledDate": "2099-03-16 22:17:52.0", "taskId": 14332, "requestType": "Project", "flexFields": [], "environmentId": 77954, "status": "REJECTED" }