Submits a code block for a Spark job to execute.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ExecuteSparkStatement

The operation that you want to perform. Set the value to ExecuteSparkStatement.

Code String Yes print(2+2)\n

The code block that you want to submit. In Linux, '\n' is used as a newline character.

JobId String Yes j202106071620hangzhou00000000001

The ID of the Spark job.

Kind String Yes scala

The programming language that is used to execute the code block. Valid values:

  • scala
  • python
  • sql

Response parameters

Parameter Type Example Description
Data String 2

The unique ID of the code block in the Spark job after the code block is submitted.

RequestId String 0DC5B6F080E8-0DC5B6F080E8-0DC5B

The unique ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format


JSON format

  "RequestId": "4BC96729-4670-4270-B08B-20C510C615E2",
  "Data": 2

Error codes

For a list of error codes, visit the API Error Center.