Skip to content

buildin_endpoints_put_cron_name

Marcel Kloubert edited this page Feb 17, 2017 · 6 revisions

Home >> Build-in endpoints >> [PUT] /api/cron(/{name})

[PUT] /api/cron(/{name})

(Re-)Starts a cron job.

This endpoint requires extension.cronJons.getJobs and/or extension.cronJons.restartJobsByName commands, as available in vs-cron extension, and canActivate property must be set to (true) for an user or guest in the settings to access the endpoint.

Examples

(Re-)Start specific job

Request:

PUT /api/cron/My%20job

Possible response:

Content-type: application/json; charset=utf-8
Content-encoding: gzip
X-Vscode-Restapi: 1.0.0
Date: Fri, 10 Feb 2017 15:47:35 GMT
Connection: keep-alive
Transfer-Encoding: chunked

{
    "code": 0,
    "data": [
        {
            "description": "A cron job",
            "detail": "I have been executed 5979 times",
            "isRunning": true,
            "name": "My job",
            "path": "/api/cron/My%20job"
        }
    ]
}

(Re-)Start all jobs

Request:

PUT /api/cron

Possible response:

Content-type: application/json; charset=utf-8
Content-encoding: gzip
X-Vscode-Restapi: 1.0.0
Date: Fri, 10 Feb 2017 15:47:35 GMT
Connection: keep-alive
Transfer-Encoding: chunked

{
    "code": 0,
    "data": [
        {
            "description": "A cron job",
            "detail": "I have been executed 5979 times",
            "isRunning": true,
            "name": "My job",
            "path": "/api/cron/My%20job"
        }
    ]
}

Other responses:

Code Description
403 User has no right to start cron jobs.
404 Cron job not found.
410 extension.cronJons.getJobs and/or extension.cronJons.restartJobsByName commands not found. s. vs-cron
Clone this wiki locally