Skip to main content
Version: 24.05

/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​

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)Dashboard API authentication key.
auth_tokenStringYes (or use api_key)Dashboard auth token.
app_idStringYesApp ID. The request is rejected without it.
methodStringYesMust be suspend_job.
idStringYes_id of the job record, as returned by Jobs List.
suspendBooleanYestrue 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​

FieldTypeDescription
resultBooleantrue when the job status was changed.
messageStringOutcome 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=true only a job that is currently SCHEDULED is changed, to SUSPENDED.
  • With suspend=false only a job that is currently SUSPENDED is changed, to SCHEDULED.
  • A job in any other state is left as it is and result is false.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.jobsJob storageUpdates the status of one job record.