/o?method=suspend_job
Endpoint
/o?method=suspend_job
Overview
Suspends a scheduled job, or sets a suspended job back to scheduled.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Requires a global administrator.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Yes (or use auth_token) | Dashboard API authentication key. |
auth_token | String | Yes (or use api_key) | Dashboard auth token. |
app_id | String | Yes | App ID. The request is rejected without it. |
method | String | Yes | Must be suspend_job. |
id | String | Yes | _id of the job record, as returned by Jobs List. |
suspend | Boolean | Yes | true to suspend a scheduled job; false to schedule a suspended job again. |
Examples
Example 1: Suspend a job
/o?method=suspend_job&
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
id=62596cd41307dc89c269b5a8&
suspend=true
Response
Success Response
{
"result": true,
"message": "Job suspended successfully"
}
Response Fields
| Field | Type | Description |
|---|---|---|
result | Boolean | true when the job status was changed. |
message | String | Outcome message. |
Error Responses
The request is answered with status 200 and result set to false when the job was not changed:
{
"result": false,
"message": "Updating job status failed, please check api logs"
}
Status Code: 400 Bad Request
{
"result": "Missing parameter \"app_id\""
}
Behavior
- With
suspend=trueonly a job that is currentlySCHEDULEDis changed, toSUSPENDED. - With
suspend=falseonly a job that is currentlySUSPENDEDis changed, toSCHEDULED. - A job in any other state is left as it is and
resultisfalse.
Related Endpoints
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly.jobs | Job storage | Updates the status of one job record. |