Help Center/ CodeArts Build/ API Reference/ Application Examples/ Example 1: Executing a Build Task and Checking Its Status
Updated on 2025-08-21 GMT+08:00

Example 1: Executing a Build Task and Checking Its Status

Scenario

This section describes how to use APIs to execute a build task and check whether the task is running.

For details about how to call APIs, see Calling APIs.

Constraints

The build task to execute has already been created in CodeArts Build.

Involved APIs

Use the API designed to execute a build task by providing key request parameters, such as the user token and the task ID. Additionally, leverage the API that monitors task progress to check the task status using the task ID. Here is how you can use these APIs:

  1. Run the build task. (For details, see Running a Build Task.)
  2. Check the task status. (For details, see Checking Task Running Status.)

Procedure

  1. Run a build task.

    • API information

      URI: POST /v3/jobs/build

      For details about the API, see Running a Build Task.

    • Example request
      POST  https://cloudbuild-ext.ap-southeast-3.myhuaweicloud.com/v3/jobs/build
    • Example request body
      {
          "job_id": "3341eaf0de6844669f07baa1ddfc9..."
      }
    • Example response
      {
          "octopus_job_name": "j_WfRE6eOY",
          "actual_build_number": "55",
          "daily_build_number": "20200825.1"
      }

  2. Check whether the task is running.

    • API information

      URI: GET /v3/jobs/{job_id}/status

      For details about the API, see Checking Task Running Status.

    • Example request
      GET  https://cloudbuild-ext.ap-southeast-3.myhuaweicloud.com/v3/jobs/3341eaf0de6844669f07bdfc9.../status
    • Example response
      {
          "result": false
      }