Skip to main content
Version: 25.03

Jobs - Suspend Job

Endpoint​

/o?method=suspend_job

Overview​

Suspends a scheduled job, or schedules a suspended job again.

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​

ParameterTypeRequiredDescription
methodStringYesMust be suspend_job.
app_idStringYesApplication ID. The request is rejected if it is missing.
idString (ObjectID)YesID of the job, as returned in _id by Jobs - Read Jobs when name is set.
suspendBooleanYestrue suspends a scheduled job. false schedules a suspended job again.
api_keyStringYes (or use auth_token)Dashboard API key.
auth_tokenStringYes (or use api_key)Dashboard auth token.

Examples​

Suspend a job​

/o?method=suspend_job&
app_id=6991c75b024cb89cdc04efd2&
api_key=YOUR_API_KEY&
id=62596cd41307dc89c269b5a8&
suspend=true

Response​

Success Response​

{
"result": true,
"message": "Job suspended successfully"
}

When a job is scheduled again (suspend=false), message is Job scheduled successfully.

Response Fields​

FieldTypeDescription
resultBooleantrue if the job status was changed.
messageStringDescription of the outcome.

Error Responses​

If the job is not found, is not in the expected status (SCHEDULED to suspend, SUSPENDED to schedule again), or the parameters are invalid, result is false:

{
"result": false,
"message": "Updating job status failed, please check api logs"
}

Behavior​

  • Only a job that is SCHEDULED can be suspended, and only a job that is SUSPENDED can be scheduled again.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.jobsJob schedulesUpdates the status of one job document.