文档

GetFileBlobs - 查询文件内容

更新时间:

通过OpenAPI查询文件内容。

适用版本

企业专属版、企业标准版

服务接入点与授权信息

产品

资源

所需权限

代码管理

文件

只读

请求语法

GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/files/{filePath}

请求头

参数

类型

是否必填

描述

示例值

x-yunxiao-token

string

个人访问令牌。

pt-0fh3****0fbG_35af****0484

请求参数

参数

类型

位置

是否必填

描述

示例值

organizationId

string

path

组织 ID。

60de7a6852743a5162b5f957

repositoryId

string

path

代码库 ID 或者 URL-Encoder 编码的全路径。

2744800

filePath

string

path

文件路径,需使用 URL-Encoder 编码进行处理。

src/Test.java

ref

string

query

指定引用名,一般为分支名,可为分支名、标签名和 CommitSHA。

master / tag1.0 / ecykhdd

请求示例

curl -X 'GET' \
  'https://test.rdc.aliyuncs.com/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/files/{filePath}?ref=<ref>' \
  -H 'accept: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

返回参数

参数

类型

描述

示例值

-

object

blobId

string

文件 git object id。

76c3f251f414ac31f2e01faf6f2008a9d756a437

commitId

string

提交 ID。

""

content

string

文件内容。

""

encoding

string

编码规则,可为{text, base64}。

text

fileName

string

文件名称。

Test.java

filePath

string

文件路径。

src/Test.java

lastCommitId

string

文件最后提交的 CommitID。

""

ref

string

一般为分支名,可为分支名、标签名或者 CommitSHA。

master / tag1.0 / ecykhdd

size

integer

文件内容大小。

10

返回示例

{
    "blobId": "76c3f251f414ac31f2e01faf6f2008a9d756a437",
    "commitId": "",
    "content": "",
    "encoding": "text",
    "fileName": "Test.java",
    "filePath": "src/Test.java",
    "lastCommitId": "",
    "ref": "master",
    "size": 10
}

错误码

访问错误码中心查看 API 相关错误码。