Help Center/ CodeArts Repo/ API Reference/ APIs/ Commit/ Querying the Submission Discrepancy Information of a Warehouse
Updated on 2023-09-12 GMT+08:00

Querying the Submission Discrepancy Information of a Warehouse

Function

This API is used to query submission difference information based on commit id.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

repo_id

Yes

Integer

Warehouse Short ID

sha

Yes

String

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

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies a user token.

It can be obtained by calling an IAM API. 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

Status code in a response

Table 4 Error

Parameter

Type

Description

code

String

Error Codes

message

String

Error message

Table 5 DiffCommitInfo

Parameter

Type

Description

old_path

String

File Path Before Change

new_path

String

File Path After Change

a_mode

String

File Mode Before Change

b_mode

String

File Mode After Change

new_file

Boolean

Whether a file is added for this change

renamed_file

Boolean

Do you want to rename the file?

deleted_file

Boolean

Indicates whether to delete files during the change.

diff

Boolean

Difference Information

Example Requests

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

Example Responses

Status code: 200

OK

{
  "result" : [ {
    "diff" : "@@ -1,4 +1,7 @@\n y_mr_0721\n+\n+! [CloudIDE run 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 Code

Description

200

OK

Error Codes

See Error Codes.