查询某个文件最近一次提交的信息。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求头

该接口使用公共请求头,无特殊请求头。请参见公共请求参数文档。

请求语法

GET /api/v3/projects/{ProjectId}/repository/files/last_commit HTTP/1.1

请求参数

名称 类型 位置 是否必选 示例值 描述
AccessToken String Query 146dd344827fe2444f952e931e51xxxx

个人访问令牌

ProjectId Long Path 100

代码库ID

OrganizationId String Query 60811b5eed6e867404f6xxxx

云效企业ID

Sha String Query master

分支名称、标签名称或Commit ID

FilePath String Query src/main/java/Main.java

文件路径

返回数据

名称 类型 示例值 描述
ErrorMessage String 文件未找到

错误信息

RequestId String xxxx-xxxx-xxxx-xxx

请求ID

Success Boolean true

请求结果

ErrorCode String SYSTEM_NOT_FOUND_ERROR

错误码

Result Object

响应结果

ShortId String f240eca9

Commit短ID

AuthorName String zhenran

作者姓名

AuthorDate String 2021-08-13T12:20:42+08:00

作者提交时间

CreatedAt String 2021-08-13T12:20:42+08:00

创建时间

Message String first commit

提交内容

Title String first commit

标题,提交的第一行内容

CommitterName String zhenran

提交者姓名

AuthorEmail String test@xxx.com

提交者邮箱

Id String f240eca931738f33603f4f411488be631b331efb

Commit ID

CommitterEmail String test@xxx.com

提交者邮箱

CommittedDate String 2021-08-13T12:20:42+08:00

提交者提交时间

ParentIds Array of String e80c21f6e852a6a9e2fe8e08da0ecb639a6f031d

父提交ID

Signature Object

签名

VerificationStatus String verified

验证状态

GpgKeyId String xxx

GPG密钥ID

示例

请求示例

GET /api/v3/projects/100/repository/files/last_commit?AccessToken=146dd344827fe2444f952e931e51xxxx&OrganizationId=60811b5eed6e867404f6xxxx&Sha=master&FilePath=src/main/java/Main.java HTTP/1.1
Host:codeup.aliyuncs.com
Content-Type:application/json

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<GetFileLastCommitResponse>
    <ErrorMessage>文件未找到</ErrorMessage>
    <RequestId>xxxx-xxxx-xxxx-xxx</RequestId>
    <Success>true</Success>
    <ErrorCode>SYSTEM_NOT_FOUND_ERROR</ErrorCode>
    <Result>
        <ShortId>f240eca9</ShortId>
        <AuthorName>zhenran</AuthorName>
        <AuthorDate>2021-08-13T12:20:42+08:00</AuthorDate>
        <CreatedAt>2021-08-13T12:20:42+08:00</CreatedAt>
        <Message>first commit</Message>
        <Title>first commit</Title>
        <CommitterName>zhenran</CommitterName>
        <AuthorEmail>test@xxx.com</AuthorEmail>
        <Id>f240eca931738f33603f4f411488be631b331efb</Id>
        <CommitterEmail>test@xxx.com</CommitterEmail>
        <CommittedDate>2021-08-13T12:20:42+08:00</CommittedDate>
        <ParentIds>e80c21f6e852a6a9e2fe8e08da0ecb639a6f031d</ParentIds>
        <Signature>
            <VerificationStatus>verified</VerificationStatus>
            <GpgKeyId>xxx</GpgKeyId>
        </Signature>
    </Result>
</GetFileLastCommitResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "ErrorMessage" : "文件未找到",
  "RequestId" : "xxxx-xxxx-xxxx-xxx",
  "Success" : true,
  "ErrorCode" : "SYSTEM_NOT_FOUND_ERROR",
  "Result" : {
    "ShortId" : "f240eca9",
    "AuthorName" : "zhenran",
    "AuthorDate" : "2021-08-13T12:20:42+08:00",
    "CreatedAt" : "2021-08-13T12:20:42+08:00",
    "Message" : "first commit",
    "Title" : "first commit",
    "CommitterName" : "zhenran",
    "AuthorEmail" : "test@xxx.com",
    "Id" : "f240eca931738f33603f4f411488be631b331efb",
    "CommitterEmail" : "test@xxx.com",
    "CommittedDate" : "2021-08-13T12:20:42+08:00",
    "ParentIds" : [ "e80c21f6e852a6a9e2fe8e08da0ecb639a6f031d" ],
    "Signature" : {
      "VerificationStatus" : "verified",
      "GpgKeyId" : "xxx"
    }
  }
}

错误码

访问错误中心查看更多错误码。