Obtaining Repository Merge Request Statistics
Function
This API is used to obtain repository merge request statistics.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
| Action | Access Level | Resource Type (*: required) | Condition Key | Alias | Dependencies |
|---|---|---|---|---|---|
| codeartsrepo:repository:getMergeRequest | Read | - | - | - | - |
URI
GET https://{hostURL}/v4/repositories/{repository_id}/merge-requests/statistic
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| repository_id | Yes | Integer | Definition You can call the API used to query all repositories of the user to query the project list to obtain the repository ID. Constraints N/A Default Value N/A Value range: 1~2147483647 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| iids | Yes | String | Definition MR IID. Value range: 1~2000 |
| fields | No | String | Definition Statistical fields. Constraints Enumeration values: |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. You can obtain the token 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. Constraints N/A Range A string that can contain 1 to 100,000 characters. Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| [items] | Array of MergeRequestStatisticDto objects | MR statistics |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | MR ID |
| iid | Integer | MR No. |
| title | String | MR title |
| state | String | MR status |
| commits_count | Integer | Number of MR commits |
| changed_files_count | String | Number of changed MR files |
| notes_count | NotesCountDto object | Number of MR review comments |
| changed_lines_count | MergeRequestLineChange object | Number of MR code changes |
| merge_error | String | MR merge exception information |
| json_merge_error | Object | MR merge exception information |
| votes | Integer | MR scores |
| Parameter | Type | Description |
|---|---|---|
| notes_count | Integer | Total number of review comments |
| unresolved_notes_count | Integer | Number of unresolved review comments |
| already_resolved_count | Integer | Number of resolved review comments |
| need_resolved_count | Integer | Total number of review comments to be resolved |
| Parameter | Type | Description |
|---|---|---|
| added_lines | Integer | Lines of code added in an MR |
| removed_lines | Integer | Lines of code deleted in an MR |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Example Requests
None
Example Responses
Status code: 200
OK
{
"id" : 47858,
"iid" : 1,
"title" : "Create file d",
"state" : "closed",
"commits_count" : 3,
"changed_files_count" : "3",
"notes_count" : 3,
"changed_lines_count" : 3,
"merge_error" : null,
"json_merge_error" : null,
"votes" : 1
} Status code: 400
Bad Request
{
"error_code" : "CH.00405011",
"error_msg" : "Request error."
} Status code: 401
Unauthorized
{
"error_code" : "DEV.00000003",
"error_msg" : "Authentication information expired."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot