GetFileBlame - Get File Blame Information

Updated at:

Retrieves line-by-line commit attribution (blame) for a specified file.

Applicable editions

Central edition, Region edition

Endpoints and Authorization Information

  • Obtain endpoints: Replace {domain} in the API request syntax.
  • Obtain a personal access token.
  • Obtain organizationId: Required only for Central edition. Go to the Basic Information page in the Organization Management console to retrieve the organization ID.

Product

Resource

Required Permissions

Code Management

File

Read-only

Request Syntax

Central edition

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

Region edition

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

Request Headers

Parameter

Type

Required

Description

Example Value

x-yunxiao-token

string

Yes

Personal access token.

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

Request Parameters

Parameter

Type

Location

Required

Description

Example Value

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

Organization ID.

60d54f3daccf2bbd6659f3ad

repositoryId

string

path

Yes

Repository ID or URL-encoded full path.

2813489 or 60de7a6852743a5162b5f957%2FDemoRepo

filePath

string

path

Yes

File path. URL-encode this parameter.

test.txt or src%2Fmain.java

ref

string

query

Yes

Reference name, typically a branch name. Can also be a tag or commit SHA.

master

Request Examples

Central edition

curl -X 'GET' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/files/test.txt or src%2Fmain.java/blame?ref=master' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region edition

curl -X 'GET' \
  'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/files/test.txt or src%2Fmain.java/blame?ref=master' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response Parameters

Parameter

Type

Description

Example Value

-

array

-

object

commit

object

authorEmail

string

Author email.

username@example.com

authorName

string

Author name.

commiter-codeup

createdAt

string

Commit timestamp.

2025-01-01T01:01:01+08:00

id

string

Commit ID.

ff4fb5ac6d1f44f452654336d2dba468ae6c8d04

shortId

string

Short commit ID.

ff4fb5ac

title

string

Commit title (the first line of the commit message).

Commit title

userId

string

Apsara Devops user ID. Use this user ID for all user ID references in Codeup OpenAPI commits.

62c795c9cf*****b468af8

contents

array[string]

start

integer

Starting line number.

1

Response Example

[
    {
        "commit": {
            "authorEmail": "username@example.com",
            "authorName": "commiter-codeup",
            "createdAt": "2025-01-01T01:01:01+08:00",
            "id": "ff4fb5ac6d1f44f452654336d2dba468ae6c8d04",
            "shortId": "ff4fb5ac",
            "title": "Commit title",
            "userId": "62c795c9cf*****b468af8"
        },
        "contents": [
            
        ],
        "start": 1
    }
]

Error Codes

For more information, see the Error Code Center.