
# 查询某个仓库的特定提交信息（废弃）
#### 功能介绍
获取由commit id或分支或标记的名称标识的特定提交。
![](https://support.huaweicloud.com/api-codeartsrepo/public_sys-resources/note_3.0-zh-cn.png)
当前API已经废弃，请使用[获取特定提交信息](https://support.huaweicloud.com/api-codeartsrepo/ShowCommit.html)。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/CodeHub/doc?api=ShowSingleCommit)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### URI
GET /v2/projects/{repo_id}/repository/commits/{sha}
表1路径参数 
| 参数      | 是否必选 | 参数类型    | 描述                        |
|:---|:---|:---|:---|
| repo_id | 是    | Integer | 仓库短id                     |
| sha     | 是    | String  | commit id，仓库的branch名或tag名 |
   
表2Query参数 
| 参数    | 是否必选 | 参数类型    | 描述                |
|:---|:---|:---|:---|
| stats | 否    | Boolean | 包括提交统计信息。默认值为true |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                            |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。 通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码： 200**
表4响应Body参数 
| 参数     | 参数类型                                                                                                     | 描述                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|
| error  | [Error] object                           | 响应错误                                                                                                                                                                                                                                                                                                                                                              |
| result | [SpecificCommitInfo] object | 响应结果                                                                                                                                                                                                                                                                                                                                                              |
| status | String                                                                                                   | **参数解释：** 调用此接口的响应状态。 **取值范围：** - success，表示接口调用成功。  - failed，表示接口调用失败。   |
   
 表5Error 
| 参数      | 参数类型   | 描述   |
|:---|:---|:---|
| code    | String | 错误码  |
| message | String | 错误信息 |
   
 表6SpecificCommitInfo 
| 参数              | 参数类型                                                                                           | 描述           |
|:---|:---|:---|
| id              | String                                                                                         | 提交对应的SHA id  |
| short_id        | String                                                                                         | 提交对应的短SHA id |
| title           | String                                                                                         | 提交标题         |
| author_name     | String                                                                                         | 作者           |
| author_email    | String                                                                                         | 作者邮箱         |
| committer_name  | String                                                                                         | 提交作者         |
| committer_email | String                                                                                         | 提交作者邮箱       |
| created_at      | String                                                                                         | 创建时间         |
| message         | String                                                                                         | 提交信息         |
| parent_ids      | Array of strings                                                                               | 父提交id        |
| committed_date  | String                                                                                         | 提交时间         |
| authored_date   | String                                                                                         | 作者提交时间       |
| stats           | [stats] object                 | 变更行数         |
| last_pipeline   | [last_pipeline] object | 流水线信息        |
   
 表7stats 
| 参数        | 参数类型    | 描述      |
|:---|:---|:---|
| additions | Integer | 变更增加的行数 |
| deletions | Integer | 变更删除的行数 |
| total     | Integer | 变更的总行数  |
   
 表8last_pipeline 
| 参数      | 参数类型    | 描述          |
|:---|:---|:---|
| id      | Integer | 流水线id       |
| sha     | String  | 提交对应的SHA id |
| ref     | String  | 分支名         |
| status  | String  | 流水线状态       |
| web_url | String  | 流水线url      |
   
#### 请求示例
```
GET https://{endpoint}/v2/projects/859341/repository/commits/master
```
#### 响应示例
**状态码： 200**
OK
```
{
  "result" : {
    "id" : "85a0a9d5c6e43bc9c3e443ac01f789e24eeef02b",
    "title" : "some commit message",
    "message" : "some commit message",
    "short_id" : "85a0a9d5",
    "author_name" : "repo",
    "author_email" : null,
    "committer_name" : "repo",
    "committer_email" : null,
    "created_at" : "2021-09-26T03:44:51.000Z",
    "parent_ids" : [ "5c114bb316dff4d4a046e09a5c44c816f2433140" ],
    "committed_date" : "2021-09-26T03:44:51.000Z",
    "authored_date" : null,
    "stats" : {
      "additions" : 1,
      "deletions" : 0,
      "total" : 1
    },
    "last_pipeline" : {
      "id" : 292811,
      "sha" : "2202af08836f0afd762d1b151d15ac510b974bdf",
      "ref" : "master",
      "status" : "running",
      "web_url" : "https://test.com/Pipeline_Beta_sdcs00001/202107171926/pipelines/292811"
    }
  },
  "status" : "success"
}
```
#### 状态码
| 状态码 | 描述 |
|:---|:---|
| 200 | OK |
   
#### 错误码
请参见错误码。
