Querying the Latest Successful Build with a Specified Code Repository
Function
This API is used to query the latest successful build with a specified code repository.
Calling Method
For details, see Calling APIs.
URI
GET /v3/jobs/{project_id}/last-history
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        project_id  | 
      
        Yes  | 
      
        String  | 
      
        Definition CodeArts project ID. For details about how to obtain the Constraints N/A. Range Use a 32-character string containing a mix of digits and letters. Default Value N/A.  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        repository_name  | 
      
        Yes  | 
      
        String  | 
      
        Definition Code repository name. Constraints The value must comply with the regular expression ^[0-9a-z]{36}$. Range Use a 36-character string that includes digits and lowercase letters. Default Value N/A.  | 
     
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.  | 
     
Response Parameters
Status code: 200
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        record_id  | 
      
        String  | 
      
        Definition Build record ID. It is a unique key. Range N/A.  | 
     
| 
        job_id  | 
      
        String  | 
      
        Definition Build task ID. Range N/A.  | 
     
| 
        job_name  | 
      
        String  | 
      
        Definition Build task name. Range N/A.  | 
     
| 
        build_number  | 
      
        Integer  | 
      
        Definition Build number. Range N/A.  | 
     
| 
        start_time  | 
      
        String  | 
      
        Definition Build start time. Range N/A.  | 
     
| 
        end_time  | 
      
        String  | 
      
        Definition Build end time. Range N/A.  | 
     
| 
        result  | 
      
        String  | 
      
        Definition Build result. Range N/A.  | 
     
| 
        commit_id  | 
      
        String  | 
      
        Definition Commit ID. 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
GET https://{endpoint}/v3/jobs/6ecbc5bac7c8442fb3d2563d53c13582/last-history?repository_name=maven-demo
 Example Responses
Status code: 200
OK
{
  "record_id" : "20210722.16",
  "job_id" : "37be03edd1da430c8079504d546cc499",
  "job_name" : "test_job_01",
  "build_number" : 16,
  "start_time" : "2021-07-22T16:26:52+08:00",
  "end_time" : "2021-07-22T16:27:15+08:00",
  "result" : "SUCCESS",
  "commit_id" : "e311c54476e0e536f0ecdeeba8dc184216fa2057"
}
 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.