Running a Build Task
Function
This API is used to run a build task and allows custom parameters.
Calling Method
For details, see Calling APIs.
URI
POST /v3/jobs/build
Request Parameters
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        X-Auth-Token  | 
      
        Yes  | 
      
        String  | 
      
        Definition User token. (The value of the X-Subject-Token response header is the user token.) It is obtained by calling the IAM API. Constraints Global tenant tokens are not supported. Use a region-level token whose scope is project. Range N/A. Default Value N/A.  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        job_id  | 
      
        Yes  | 
      
        String  | 
      
        Definition Build task ID. It includes digits and letters. To obtain this ID, open the page for editing the build task in your browser, and copy the 32-character string at the end of the URL. Constraints The 32-character string sits at the end of the URL and includes digits and letters. Range N/A. Default Value N/A.  | 
     
| 
        parameter  | 
      
        No  | 
      
        Array of ParameterItem objects  | 
      
        Definition Custom parameter. Constraints N/A. Range N/A. Default Value N/A.  | 
     
| 
        scm  | 
      
        No  | 
      
        Scm object  | 
      
        Definition Code information. Constraints N/A. Range N/A. Default Value N/A.  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        name  | 
      
        Yes  | 
      
        String  | 
      
        Definition Custom parameter name. Constraints ● Do not use the following fields: LD_PRELOAD, LD_LIBRARY_PATH, PATH, BASH_ENV, GIT_SSH_COMMAND, and path. ● Symbols are not supported. Range Custom parameter name. The length cannot exceed 128 characters. Only letters, digits, and underscores (_) are supported. Default Value N/A.  | 
     
| 
        value  | 
      
        Yes  | 
      
        String  | 
      
        Definition Parameter value. Constraints N/A. Range Default value of the custom parameter. Max. 8,192 characters. Default Value N/A.  | 
     
Response Parameters
Status code: 200
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        octopus_job_name  | 
      
        String  | 
      
        Definition Temporary task name. Range N/A.  | 
     
| 
        actual_build_number  | 
      
        String  | 
      
        Definition Number of actual builds. Range N/A.  | 
     
| 
        daily_build_number  | 
      
        String  | 
      
        Definition Daily build number. Range N/A.  | 
     
Status code: 400
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Error code.  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Error message.  | 
     
Status code: 401
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Error code.  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Error message.  | 
     
Status code: 403
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Error code.  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Error message.  | 
     
Status code: 404
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Error code.  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Error message.  | 
     
Status code: 500
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Error code.  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Error message.  | 
     
Example Requests
Run the build task whose task ID is f9d6c8466d614a9788e9a0acf6c15f46. The task uses the codeBranch code repository and the master branch.
POST https://{endpoint}/v3/jobs/build
{
  "job_id" : "f9d6c8466d614a9788e9a0acf6c15f46",
  "parameter" : [ {
    "name" : "codeBranch",
    "value" : "master"
  } ],
  "scm" : {
    "build_tag" : null,
    "build_commit_id" : "build_commit_id"
  }
}
 Example Responses
Status code: 200
OK
{
  "octopus_job_name" : "j_Oaqg...",
  "actual_build_number" : "20",
  "daily_build_number" : "20200612.20"
}
 Status Codes
| 
        Status Code  | 
      
        Description  | 
     
|---|---|
| 
        200  | 
      
        OK  | 
     
| 
        400  | 
      
        Bad Request  | 
     
| 
        401  | 
      
        Unauthorized  | 
     
| 
        403  | 
      
        Forbidden  | 
     
| 
        404  | 
      
        Not Found  | 
     
| 
        500  | 
      
        Internal Server Error  | 
     
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.