Skip to content

REST: Scheduled jobs management

bugzmanov edited this page Mar 20, 2013 · 9 revisions

List systems jobs stat

Path:/rest/jobs-stat

Type: GET

Example results:

{"links":[],
 "items": [
     {
        "projectId":1,
        "scheduledJobs":2,
        "failedJobs":1,
        "links":
           [{"href":"http://localhost:8080/rest/projects/1/jobs",
             "rel":"self",
             "type":"application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
             "methods":["get"]}]
     }
  ]
}

List project jobs

Path:/rest/projects/(projectId)/jobs

Type: GET

Path parameters

Parameter Type Description
projectId Number id of the project credentials belong to

Example results:

{
    "failed": [{
            "item": {
                "id": "1",
                "projectId": 1,
                "envId": 1,
                "date": 1363763640000,
                "workflow": "another",
                "variables": {
                    "count": "1"
                },
                "scheduledBy": "Scheduler / genesis",
                "failureDescription": "Workflow execution failed",
                "workflowId": 2
            },
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/1/failedJobs/1",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["delete"]
                }
            ]
        }
    ],
    "requested": [{
            "item": {
                "id": "execution-destroy-env-1",
                "projectId": 1,
                "envId": 1,
                "date": 1364368327497,
                "workflow": "destroy",
                "variables": {},
                "scheduledBy": "genesis"
            },
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/1/jobs/execution-destroy-env-1",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["put", "delete"]
                }
            ]
        }, {
            "item": {
                "id": "execution-destroy-env-2",
                "projectId": 1,
                "envId": 2,
                "date": 1364373126772,
                "workflow": "destroy",
                "variables": {},
                "scheduledBy": "genesis"
            },
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/2/jobs/execution-destroy-env-2",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["put", "delete"]
                }
            ]
        }
    ]
}

List environment requested jobs

Path:/rest/projects/(projectId)/envs/(envId)/jobs

Type: GET

Path parameters

Parameter Type Description
projectId Number id of the project credentials belong to
envId Number id of the environment

Example results:

{
    "links": [{
            "href": "http://localhost:8080/rest/projects/1/envs/2/jobs",
            "rel": "self",
            "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
            "methods": ["get", "post"]
        }
    ],
    "items": [{
            "id": "execution-destroy-env-2",
            "projectId": 1,
            "envId": 2,
            "date": 1364373126772,
            "workflow": "destroy",
            "variables": {},
            "scheduledBy": "genesis",
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/2/jobs/execution-destroy-env-2",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["put", "delete"]
                }
            ]
        }
    ]
}

List project jobs

Path:/rest/projects/(projectId)/jobs

Type: GET

Path parameters

Parameter Type Description
projectId Number id of the project credentials belong to

Example results:

{
    "failed": [{
            "item": {
                "id": "1",
                "projectId": 1,
                "envId": 1,
                "date": 1363763640000,
                "workflow": "another",
                "variables": {
                    "count": "1"
                },
                "scheduledBy": "Scheduler / genesis",
                "failureDescription": "Workflow execution failed",
                "workflowId": 2
            },
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/1/failedJobs/1",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["delete"]
                }
            ]
        }
    ],
    "requested": [{
            "item": {
                "id": "execution-destroy-env-1",
                "projectId": 1,
                "envId": 1,
                "date": 1364368327497,
                "workflow": "destroy",
                "variables": {},
                "scheduledBy": "genesis"
            },
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/1/jobs/execution-destroy-env-1",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["put", "delete"]
                }
            ]
        }, {
            "item": {
                "id": "execution-destroy-env-2",
                "projectId": 1,
                "envId": 2,
                "date": 1364373126772,
                "workflow": "destroy",
                "variables": {},
                "scheduledBy": "genesis"
            },
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/2/jobs/execution-destroy-env-2",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["put", "delete"]
                }
            ]
        }
    ]
}

List environment failed jobs

Path:/rest/projects/(projectId)/envs/(envId)/failedJobs

Type: GET

Path parameters

Parameter Type Description
projectId Number id of the project credentials belong to
envId Number id of the environment

Example results:

{
    "links": [{
            "href": "http://localhost:8080/rest/projects/1/envs/1/failedJobs",
            "rel": "self",
            "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
            "methods": ["get"]
        }
    ],
    "items": [{
            "id": "1",
            "projectId": 1,
            "envId": 1,
            "date": 1363763640000,
            "workflow": "another",
            "variables": {
                "count": "1"
            },
            "scheduledBy": "Scheduler / genesis",
            "failureDescription": "Workflow execution failed",
            "workflowId": 2,
            "links": [{
                    "href": "http://localhost:8080/rest/projects/1/envs/1/failedJobs/1",
                    "rel": "self",
                    "type": "application/vnd.griddynamics.genesis.ScheduledJobDetails+json",
                    "methods": ["delete"]
                }
            ]
        }
    ]
}

Schedule workflow execution for environment

Path:/rest/projects/(projectId)/envs/(envId)/jobs

Type: POST

Path parameters

Parameter Type Description
projectId Number id of the project credentials belong to
envId Number id of the environment

**Request body structure**

Request body consists form a single JSON map contains the following entries:

Entry name Entry predefined value Type Description
parameters В  JSON object parameters used by execution action

Parameters JSON object structure:

Entry name Type Description
variables Map of String pairs Workflow variable values customized by user

Request example

{ 
  "workflow":"another",
  "executionDate":1364642100000,
  "parameters":{"count":"1"}}

Response example

{"result":"2013-03-30T11:15:00Z","isSuccess":true}
Clone this wiki locally