Managing job sequences

After a job sequence is created, the next step is to manage the sequence using the following tasks:

It's important to note how each task changes a job sequence's status. Refer to Job sequence statuses to learn more about each status.

Start a job sequence

Starts the job sequence specified by the job sequence's flow ID.

Note: Before starting a job sequence, the following prerequisites are required:
  • Your latest changes must have been published. See publish your changes for instructions.

  • The job sequence must be active.

Starting a job sequence will start the first job configured in the sequence. In the example below, the first job configured in the sequence is the Ingest job.

An image of a job sequence example

Whereas you can also configure your job sequence to run multiple jobs in parallel at the beginning of the sequence. In the example diagram below, starting this job sequence will trigger Ingest job 1, 2, and 3 to start simultaneously.

An image of a job sequence using the "and" condition

 

Service URL

POST {host}/api/cx-unity-api/flows/{flowId}/start

Path parameters

  • flowId - The Flow ID of the job sequence to start.

Request body

N/A

Response

A successful response indicates the job sequence was started successfully and returns the job sequence's run ID.

{
  "status": "SUCCESS",
  "message": "Flow started successfully",
  "runId": "42d0b95025bd4c97b4d8263ec86504b7"
}

Sample error responses

The job sequence can't start because it's not published. Publish changes before starting: This error is displayed if you attempt to start a job sequence that is not yet published. After creating or updating job sequences, you must publish your changes, before you can start the job sequence.

{
  "status": "ERROR",
  "message": "The job sequence can't start because it's not published. Publish changes before starting."
}

The job sequence can't start because it's not active. Set the job sequence to active before starting: This error is displayed if you attempt to start a job sequence that is not yet active. Update the job sequence and set active to true.

{
  "status": "ERROR",
  "message": "The job sequence can't start because it's not active. Set the job sequence to active before starting."
}

The job sequence can't start because flow id = Flow 1 is not found: This message may appear when users are attempting to start a job sequence, but the job sequence with the specified ID does not exist.

{
  "status": "ERROR",
  "message": "The job sequence can't start because flow id = Flow 1 is not found."
}

The job sequence doesn't have an initial job. Configure an initial job using the "depends" parameter and empty brackets: This message appears when a gate job type does not have more than 1 job. Gate job types must have more than 1 job configured.

{
  "type": "",
  "title": "System Error",
  "detail": "The job sequence can't start because it doesn't have an initial job. Configure an initial job using the \"depends\" parameter and empty brackets.",
  "o:errorCode": "InvalidFlowException",
  "o:errorDetails": []
}

Stop a job sequence run

Stops the particular run of the job sequence. After a job sequence has been stopped using this endpoint, you can resume the job sequence.

Service URL

POST {host}/api/cx-unity-api/flows/{flowId}/runs/{runId}/stop

Path Parameters

  • flowId - The job sequence's flow ID to stop.

  • runId - The job sequence's run ID to stop.

Request body

N/A

Response

A successful response returns the status of your request, a message indicating whether the stop request was successful, and the job run IDs within the job sequence.

{
  "status": "SUCCESS",
  "message": "Successfully stopped the flow",
  "runId": "42d0b95025bd4c97b4d8263ec86504b7"
}

Sample error responses

The job sequence with flowId = XXXX and runId = YYYY can't be stopped because the current status is ZZZZ: Users may see this error when attempting to stop a specific run of a job sequence, but the job sequence is not running yet. Verify whether the job sequence is running, and retry the request.

{
  "runId": "8F12953C5C9E4223948E023834834D51dd",
  "status": "ERROR",
  "message": "The job sequence with flowId = XXXX and runId = YYYY can't be stopped because the current status is ZZZZ."
}

Stop all running jobs in job sequence

Stops all running instances of job sequence. Once stopped using this endpoint, the job sequence cannot be resumed.

Service URL

POST {host}/api/cx-unity-api/flows/{flowId}/stop

Path Parameters

  • flowId - The job sequence's flow ID to stop.

Request body

N/A

Response

A successful response returns the status of your request, a message indicating whether the stop request was succesful, and the job run IDs within the job sequence.

[
  {
    "status": "SUCCESS",
    "message": "Successfully stopped the flow",
    "runId": "42d0b95025bd4c97b4d8263ec86504b7"
  },
  {
    "status": "SUCCESS",
    "message": "Successfully stopped the flow",
    "runId": "52d0b96025bds4ckjbs4r5643ru867834"
  }
]

Resume a job sequence

Resumes a paused job sequence.

Note: Before you can resume a job sequence:
  • The job must have been stopped by the system and be in FAILED status.

Service URL

POST {host}/api/cx-unity-api/flows/{flowId}/resume

Path Parameters

  • flowId - The job sequence's flow ID to resume.

Request body

N/A

Response

A successful response returns a message indicating the job sequence was started successfully, and the job sequence's run ID.

{
  "status": "SUCCESS",
  "message": "Flow started successfully",
  "runId": "4d2b8f66bbc44677ac5aec04a9ab3d5d"
}

Sample error responses

The job sequence with flowId = XXXX and runId = YYYY can't be resumed because the current status is ZZZZ: Users may see this error when resuming a job sequence, but the job sequence is not in FAILED status. Job sequence must be in failed status (stopped by the system) to resume.

{
  "runId": "8F12953C5C9E4223948E023834834D51dd",
  "status": "ERROR",
  "message": "The job sequence with flowId = XXXX and runId = YYYY can't be resumed because the current status is ZZZZ."
}

Learn more

Jobs API

Viewing job sequence run details