Help Center/ CodeArts Repo/ API Reference (Ally Region)/ APIs/ Commit/ Querying the Commit Difference Information of a Repository
Updated on 2026-01-08 GMT+08:00

Querying the Commit Difference Information of a Repository

Description

This API is used to query commit difference information by commit ID.

URI

GET /v2/projects/{repo_id}/repository/commits/{sha}/diff

Table 1 Path parameters

Parameter

Mandatory

Type

Description

repo_id

Yes

Integer

Repository short ID

sha

Yes

String

Commit ID, which is the branch or tag name of the repository.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

error

Error object

Response error

result

Array of DiffCommitInfo objects

Difference list

status

String

Response status

Table 4 Error

Parameter

Type

Description

code

String

Error codes

message

String

Error message

Table 5 DiffCommitInfo

Parameter

Type

Description

old_path

String

Old file path

new_path

String

New file path

a_mode

String

Old file mode

b_mode

String

New file mode

new_file

Boolean

Whether to add files during the modification

renamed_file

Boolean

Whether to rename a file during the modification

deleted_file

Boolean

Whether to delete files during the modification

diff

Boolean

Difference information

Request Examples

GET https://{endpoint}/v2/projects/859341/repository/commits/master/diff

Response Examples

Status code: 200

Request succeeded

{
  "result" : [ {
    "diff" : "@@ -1,4 +1,7 @@\n y_mr_0721\n+\n+![CloudIDE Executed successfully](./image/screenshot.PNG)\n+\n edwwd\n # css \n **hhrh**",
    "old_path" : "README.md",
    "new_path" : "README.md",
    "a_mode" : "100644",
    "b_mode" : "100644",
    "new_file" : false,
    "renamed_file" : false,
    "deleted_file" : false
  } ],
  "status" : "success"
}

Status Codes

Status Codes

Description

200

Request succeeded

Error Codes

See Error Codes.