Updated on 2026-11-06 GMT+08:00

Listing Spark Jobs

Function

This API is used to list Spark jobs in a workspace. This API is synchronous. It supports filtering by job ID, job name, job status, job type, creation time, etc., and supports pagination. After a successful call, the job list data is returned directly.

Calling Method

For details, see Calling APIs.

URI

GET /v2/workspaces/{workspace_id}/spark-jobs

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

workspace_id

Yes

String

Definition: Workspace ID, used for resource isolation. This can be viewed on the workspace page of the console.

Constraints: N/A

Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

marker

No

String

Definition: Job ID cursor position, used for pagination.

Constraints: For the first query, this parameter can be omitted. For subsequent queries, pass the next_marker value returned in the previous response.

Range: Fixed at 36 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed.

Default Value: N/A

limit

No

Integer

Definition: Number of records to query, used for pagination.

Constraints: N/A

Range: Integer from 1 to 100.

Default Value: 10.

page_reverse

No

Boolean

Definition: Whether to query in reverse page order, which specifies the pagination direction.

Constraints: When set to true, the marker parameter must be specified.

Range

  • true: Queries the previous page of data.

  • false: Queries the next page of data.

Default Value: false

name

No

String

Definition: Job name, used for fuzzy search of jobs.

Constraints: N/A

Range: The value can contain 0 to 128 characters, with no character type restrictions.

Default Value: N/A

create_time_after

No

Long

Definition: Used to query jobs created after this timestamp.

Constraints: N/A

Range: Minimum value: 1764061598000. Unix timestamp in milliseconds.

Default Value: N/A

create_time_before

No

Long

Definition: Used to query jobs created before this timestamp.

Constraints: N/A

Range: Minimum value: 1764061598000. Unix timestamp in milliseconds.

Default Value: N/A

endpoint_name

No

String

Definition: Endpoint name, used to specify the Spark job execution environment.

Constraints: N/A

Range: 1 to 63 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a lowercase letter and end with a lowercase letter or digit.

Default Value: N/A

states

No

Array of strings

Definition: List of Spark job statuses, used to filter and query jobs with specific statuses. The array elements are of the String type. The meanings of the values are as follows:

  • PENDING: Starting.

  • QUEUED: Queued.

  • RUNNING: Running.

  • CANCELING: Canceling.

  • CANCELED: Canceled.

  • FAILED: Failed.

  • SUCCEED: Succeeded.

  • QUEUED_TIMEOUT: Queued timeout.

  • RUNNING_TIMEOUT: Running timeout.

Constraints: A maximum of 10 statuses can be queried.

Default Value: N/A

job_type

No

String

Definition: Job type, used to filter and query jobs of a specific type.

Constraints: N/A

Range

  • SPARK_JAR_JOB: Spark JAR job.

  • SPARK_PYTHON_JOB: Python Spark job.

  • SPARK_SQL_SCRIPTING_JOB: SQL script job (reserved type).

Default Value: N/A

job_id

No

String

Definition: Spark job ID, used for precise query of a specific job. It can be obtained from the job_id in the response of the API for starting a Spark job or from the API for listing Spark jobs.

Constraints: N/A

Range: 1 to 64 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed.

Default Value: N/A

create_user_id

No

String

Definition: Spark job creator ID, used to filter and query jobs created by a specific user. This can be obtained by calling the API for querying user information or viewed on the user management page of the console.

Constraints: N/A

Range: The value can contain 1 to 256 characters, with no character type restrictions.

Default Value: N/A

create_user_name

No

String

Definition: Spark job creator name, which is used to filter and query jobs created by a specific user.

Constraints: N/A

Range: The value can contain 1 to 256 characters, with no character type restrictions.

Default Value: N/A

labels

No

String

Definition: Job tags, used to filter and query jobs by tags. Multiple labels can be used for filtering. Format: key=value. Multiple tags are separated by commas (,).

Constraints: In the URL, = must be escaped as %3D. Example: labels=k1%3Dv1,k2%3Dv2.

Range: The value can contain 1 to 1,024 characters, with no character type restrictions.

Default Value: N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: The value can contain a maximum of 65,534 characters, with no character type restrictions.

Default Value: N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

page_info

SparkMarkerPageInfo object

Definition: Pagination information, including the cursor of the previous page, cursor of the next page, and the number of records on the current page.

jobs

Array of ListSparkJobResponseDto objects

Definition: Spark job list, containing detailed job information.

Table 5 SparkMarkerPageInfo

Parameter

Type

Description

next_marker

String

Definition: Next page cursor, used to identify the starting position of the next page of data. An empty value indicates no more data.

Range: Fixed at 36 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed. Example: 6c98db52-cac2-4ff1-9a91-b7793e95557d.

previous_marker

String

Definition: Previous page cursor, which is used to identify the start position of the previous page of data. If this parameter is left blank, the current page is the first page.

Range: Fixed at 36 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed.

current_count

Integer

Definition: Number of data items on the current page, used to identify the amount of data returned in the current response.

Range: Integer greater than or equal to 0. Maximum value: 100.

Table 6 ListSparkJobResponseDto

Parameter

Type

Description

job_id

String

Definition: Spark job ID, used to uniquely identify a job.

Range: 1 to 64 characters. Only hexadecimal characters, hyphens (-), and underscores (_) are allowed. Example: 80ceaaff-3cfc-4162-a56f-70031ea4fa91.

client_token

String

Definition: Spark job transaction ID, used to prevent duplicate submissions.

Range: UUID format, 36 characters. Example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

name

String

Definition: Spark job name, used to identify the job.

Range: 1 to 128 characters.

endpoint_name

String

Definition: Endpoint name, used to specify the Spark job execution environment.

Range: 1 to 63 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a lowercase letter and end with a lowercase letter or digit.

endpoint_id

String

Definition: Endpoint ID, which uniquely identifies the Spark job execution environment.

Range: UUID format, 36 characters.

job_type

String

Definition: Job type, used to identify the type of the job.

Range

  • SPARK_JAR_JOB: Spark JAR job.

  • SPARK_PYTHON_JOB: Python Spark job.

  • SPARK_SQL_SCRIPTING_JOB: SQL script job (reserved type).

state

String

Definition: Spark job status, used to identify the current execution status of the job.

Range

  • PENDING: Starting.

  • QUEUED: Queued.

  • RUNNING: Running.

  • CANCELING: Canceling.

  • CANCELED: Canceled.

  • FAILED: Failed.

  • SUCCEED: Succeeded.

  • QUEUED_TIMEOUT: Queue timeout.

  • RUNNING_TIMEOUT: Running timeout.

state_message

String

Definition: Job status message, displaying relevant information when the job ends abnormally.

Range: 0 to 512 characters.

retry_times

Integer

Definition: Job retry count, used to record the number of retries after a job failure.

Range: Minimum value: 0.

create_time

Long

Definition: Job creation time, used to record when the job was submitted. The value is a Unix timestamp in milliseconds.

Range: N/A

start_time

Long

Definition: Job start time, used to record when the job actually started execution. The value is a Unix timestamp in milliseconds.

Range: N/A

end_time

Long

Definition: Job end time, used to record when the job execution completed. The value is a Unix timestamp in milliseconds.

Range: N/A

create_user

SparkCreateUser object

Definition: Information about the user who creates the job.

log_url

String

Definition: Log archive path (OBS URL), used to view job execution logs.

Range: OBS URL format, 1 to 1,024 characters.

Table 7 SparkCreateUser

Parameter

Type

Description

user_id

String

Definition: User ID of the job creator, used to identify the job creator.

Range: The value can contain 1 to 256 characters, with no character type restrictions.

user_name

String

Definition: User name of the job creator, used to identify the job creator.

Range: The value can contain 1 to 256 characters, with no character type restrictions.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, used to identify a specific error type.

Range: 0 to 64 characters.

error_msg

String

Definition: Error description, used to explain the cause of an error.

Range: 0 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Example Requests

Filter by job status to query Spark jobs in SUCCEED state, with two records per page.

GET /v2/workspaces/{workspace_id}/spark-jobs?limit=2&states=SUCCEED

Example Responses

Status code: 200

{
  "page_info" : {
    "next_marker" : "1ee7d9db-90ec-4b71-89b8-0de936dade77",
    "current_count" : 2
  },
  "jobs" : [ {
    "job_id" : "80ceaaff-3cfc-4162-a56f-70031ea4fa91",
    "client_token" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "name" : "spark-job-example",
    "endpoint_name" : "my-spark-endpoint",
    "state" : "SUCCEED",
    "job_type" : "SPARK_JAR_JOB",
    "retry_times" : 1,
    "create_time" : 1764061598000,
    "start_time" : 1764061648000,
    "end_time" : 1764061898000,
    "create_user" : {
      "user_id" : "user123",
      "user_name" : "admin"
    },
    "log_url" : "obs://my-bucket/aidatalake/workspace_52edbbd3e5f6470a9c1b8d2e3f4a5b6c/spark/endpoint_b242c8569d1e4f7a8c3b5d6e2f0a4c71/jobs/logs/2025_11_25/80ceaaff-3cfc-4162-a56f-70031ea4fa91/1/spark_ai-datalake-spark-80ceaaff-driver_spark-job-b242c856/spark.log"
  }, {
    "job_id" : "1ee7d9db-90ec-4b71-89b8-0de936dade77",
    "client_token" : "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
    "name" : "spark-python-job",
    "endpoint_name" : "my-spark-endpoint",
    "state" : "SUCCEED",
    "job_type" : "SPARK_PYTHON_JOB",
    "retry_times" : 1,
    "create_time" : 1764061698000,
    "start_time" : 1764061748000,
    "end_time" : 1764061898000,
    "create_user" : {
      "user_id" : "user456",
      "user_name" : "developer"
    },
    "log_url" : "obs://my-bucket/aidatalake/workspace_52edbbd3e5f6470a9c1b8d2e3f4a5b6c/spark/endpoint_b242c8569d1e4f7a8c3b5d6e2f0a4c71/jobs/logs/2025_11_25/1ee7d9db-90ec-4b71-89b8-0de936dade77/1/spark_ai-datalake-spark-1ee7d9db-driver_spark-job-b242c856/spark.log"
  } ]
}

Status code: 400

{
  "error_code" : "AIDataLake.01011001",
  "error_msg" : "Invalid parameter name",
  "solution_msg" : "Please check the input parameters according to the documentation(name for spark job)."
}

Status code: 401

{
  "error_code" : "AIDataLake.01011003",
  "error_msg" : "auth token not exists in header",
  "solution_msg" : "Please check if auth token is included in the request header."
}

Status code: 403

{
  "error_code" : "AIDataLake.01011005",
  "error_msg" : "current account has no permission",
  "solution_msg" : "Please connect administrators to add permission."
}

Status code: 500

{
  "error_code" : "AIDataLake.01010001",
  "error_msg" : "Internal system error",
  "solution_msg" : "Contact operations for analysis."
}

Status Codes

Status Code

Description

200

Spark jobs successfully listed.

400

Invalid request parameter.

401

Authentication failed.

403

Insufficient permissions.

500

Internal server error.