Skip to content

buildin_endpoints_delete_cron_name

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

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

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

Stops a cron job.

This endpoint requires extension.cronJons.getJobs and/or extension.cronJons.stopJobsByName 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

Stop specific job

Request:

DELETE /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": false,
            "name": "My job",
            "path": "/api/cron/My%20job"
        }
    ]
}

Stop all jobs

Request:

DELETE /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": false,
            "name": "My job",
            "path": "/api/cron/My%20job"
        }
    ]
}

Other responses:

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