Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ CodeArts Repo/ API Reference/ APIs/ Review/ Obtaining a Review List

Obtaining a Review List

Updated on 2025-01-14 GMT+08:00

Function

This API is used to obtain a review list.

URI

GET /v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions

Table 1 Path parameters

Parameter

Mandatory

Type

Description

repository_id

Yes

String

Explanation:

Repository ID.

Constraints:

Mandatory

Range:

Minimum value: 1

Maximum value: 214748364

merge_request_iid

Yes

Integer

Explanation:

MR IID (MR sequence number in the repository).

Constraints:

Mandatory

Range:

Minimum value: 1

Maximum value: 2147483647

Table 2 Query parameters

Parameter

Mandatory

Type

Description

type

No

String

Explanation:

Review comment type.

Range:

  • user: Review comments created by a user.
  • system: Review comments created by the system.

unresolved

No

String

Explanation:

Whether to return unresolved reviews.

Range:

  • true: Yes
  • false: No

view

No

String

Explanation:

Whether to return basic or detailed information.

Range:

  • basic: Return basic information.
  • simple: Return detailed information.

author_id

No

String

Explanation:

A user ID or username for filtering review comments created by a user.

Range:

Max. 255 characters.

page

No

Integer

Explanation:

Number of the page whose review comments will be returned.

Range:

Minimum value: 1

Maximum value: 2147483647

Default value:

1

per_page

No

Integer

Explanation:

Pagination parameter, which indicates the number of comments displayed on each page.

Range:

Minimum value: 1

Maximum value: 100

Default value:

20

Request Parameters

None.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

error

Error object

Explanation:

Response error code.

result

Array of MergeRequestDiscussionDto object

Explanation:

Review comment information.

Range:

None

status

String

Explanation:

Response status.

Range:

  • success: The API call is successful.
  • failed: The API call failed.
Table 4 Error

Parameter

Type

Description

code

String

Explanation:

Error code returned when the API fails to be called.

Range:

  • CH.10000. The system is busy. Try again later.

message

String

Explanation:

Error message returned when the API fails to be called.

Range:

  • The system is busy. Try again later.
Table 5 MergeRequestDiscussionDto

Parameter

Type

Description

id

String

Explanation:

ID shared by the main comment and reply, which is generally called discussion_id.

Range:

40 digits and letters.

individual_note

Boolean

Explanation:

Whether the comment is individual and does not need resolution by others.

Range:

  • true: Yes
  • false: No

notes

Array of NoteDto objects

Explanation:

Main comment and reply list. The first one is the main comment. (This API is used to create a main comment. Therefore, there is only one comment.)

Range:

None

project_id

Integer

Explanation:

Repository ID.

Range:

Minimum value: 1

Maximum value: 2147483647

noteable_type

String

Explanation:

Comment type.

Range:

  • MergeRequest: Comment for MR (When you select a commit under an MR and add a review comment, the comment is still of the MergeRequest type).
  • Commit: Comment for code or a specific commit.

commit_id

String

Explanation:

Associated commit ID: SHA value of a commit. This field applies when noteable_type is set to Commit.

Range:

40 digits and letters.

project_full_path

String

Explanation:

Repository path.

Range:

None

a_mode

String

Explanation:

Mode of an associated file before the change. If the file is new, the value is 0.

Range:

File permissions supported by Git, for example, 100644, 100755, 120000, and 160000.

b_mode

String

Explanation:

Mode of an associated file after the change. If the file is deleted, the value is 0.

Range:

File permissions supported by Git, for example, 100644, 100755, 120000, and 160000.

deleted_file

Boolean

Explanation:

Whether an associated file is deleted.

Range:

  • true: Yes
  • false or null: No

new_file

Boolean

Explanation:

Whether an associated file is new.

Range:

  • true: Yes
  • false or null: No

resolved

Boolean

Explanation:

Whether the review comment has been resolved.

Range:

  • true: Yes
  • false or null: No

archived

Boolean

Explanation:

Whether the review comment has been archived. Archived comments cannot be edited, deleted, replied, or resolved.

Range:

  • true: Yes
  • false or null: No

review_categories

String

Explanation:

Comment type key.

The values of review_categories and review_categories_cnreview_categories_en must match.

Range:

None

review_categories_cn

String

Explanation:

Comment type in Chinese.

The values of review_categories and review_categories_cn must match.

Range:

None

review_categories_en

String

Explanation:

Comment type in English.

The values of review_categories and review_categories_en must match.

Range:

None

review_modules

String

Explanation:

Review comment module.

Range:

None

severity

String

Explanation:

Review comment severity key.

Range:

  • suggestion
  • minor
  • major
  • fatal

severity_cn

String

Explanation:

Severity in Chinese.

Range:

  • Suggestion
  • Minor
  • Major
  • Fatal

severity_en

String

Explanation:

Severity in English.

Range:

  • Suggestion
  • Minor
  • Major
  • Fatal

assignee

UserBasicDto object

Explanation:

Assignee details.

Range:

None

proposer

UserBasicDto object

Explanation:

Reviewer details.

Range:

None

merge_request_version_params

MergeRequestVersionParamsDto object

Explanation:

MR version details.

Range:

None

diff_file

String

Explanation:

File path change.

Range:

None

added_lines

Integer

Explanation:

Number of new lines.

Range:

Minimum value: 0

Maximum value: 2147483647

removed_lines

Integer

Explanation:

Number of deleted lines.

Range:

Minimum value: 0

Maximum value: 2147483647

Table 6 NoteDto

Parameter

Type

Description

id

Integer

Explanation:

Comment ID, which is not shared by the main comment and replies.

Range:

Minimum value: 1

Maximum value: 2147483647

type

String

Explanation:

Note type.

Range:

  • DiffNote: A comment that needs to be resolved on the file change page.
  • MergeRequestNote: A comment that needs to be resolved on the details page.
  • null: A comment that does not need to be resolved on the details page.

body

String

Explanation:

Review comment content.

Range:

Maximum length: 8,000 characters.

Characters: Unicode \u0000 to \uffff. Special characters, such as emojis and uncommon characters, are not supported.

Blank: The value cannot be null, an empty string, or only spaces.

attachment

String

Explanation:

Attachment. (This field has been discarded.)

Range:

None

author

UserBasicDto object

Explanation:

Author details.

Range:

None

created_at

String

Explanation:

Creation time.

Constraints:

Format: yyyy-MM-ddTHH:mm:ss.SSS+08:00

updated_at

String

Explanation:

Update time.

Constraints:

Format: yyyy-MM-ddTHH:mm:ss.SSS+08:00

system

Boolean

Explanation:

Whether the comment is generated by the system.

Range:

  • true: Yes. The comment is created by the system.
  • false: No. The comment is created by a user.

noteable_id

Integer

Explanation:

MR ID.

Range:

Minimum value: 1

Maximum value: 2147483647

noteable_type

String

Explanation:

Comment type.

Range:

  • MergeRequest: Comment for MR or CR (When you select a commit under an MR or CR and add a review comment, the comment is still of the MergeRequest type).
  • Commit: Comment for code or a specific commit.

commit_id

String

Explanation:

Associated commit ID: SHA value of a commit. This field applies when noteable_type is set to Commit.

Range:

40 digits and letters.

resolvable

Boolean

Explanation:

Whether the comment needs to be resolved.

Range:

  • true: Yes
  • false or null: No

is_reply

Boolean

Explanation:

Whether the comment is a reply.

Range:

  • true: Yes. The comment is a reply.
  • false: No. The comment is a main comment.

resolved_by

UserBasicDto object

Explanation:

Comment resolver.

Range:

None

noteable_iid

Integer

Explanation:

MR IID, indicating the sequence number of the MR in the repository.

Range:

Minimum value: 1

Maximum value: 2147483647

discussion_id

String

Explanation:

Review comment ID, which is shared by the main comment and replies.

Range:

40 digits and letters.

project

String

Explanation:

Project path.

Range:

None

diff_file

String

Explanation:

File path change.

Range:

None

diff

String

Explanation:

File content change.

Range:

None

archived

Boolean

Explanation:

Whether the review comment has been archived. Archived comments cannot be edited, deleted, replied, or resolved.

Range:

  • true: Yes
  • false or null: No

review_categories

String

Explanation:

Comment type key.

The values of review_categories, review_categories_cn, and review_categories_en must match.

Range:

None

review_categories_cn

String

Explanation:

Comment type in Chinese.

The values of review_categories and review_categories_cn must match.

Range:

None

review_categories_en

String

Explanation:

Comment type in English.

The values of review_categories and review_categories_en must match.

Range:

None

review_modules

String

Explanation:

Review comment module.

Range:

None

severity

String

Explanation:

Severity. Non-suggestion reviews cannot be resolved by the assignee, MR creator, or committer.

Range:

  • suggestion
  • minor
  • major
  • fatal

severity_cn

String

Explanation:

Severity in Chinese.

Range:

  • Suggestion
  • Minor
  • Major
  • Fatal

severity_en

String

Explanation:

Severity in English.

Range:

  • Suggestion
  • Minor
  • Major
  • Fatal

file_path

String

Explanation:

File path. (This field has been discarded.)

Range:

None

line

String

Explanation:

Line number. (This field has been discarded.)

Range:

None

assignee

UserBasicDto object

Explanation:

Assignee details.

Range:

None

proposer

UserBasicDto object

Explanation:

Reviewer details.

Range:

None

position

PositionDto object

Explanation:

Code location information to associate the comment with.

Range:

None

resolved

Boolean

Explanation:

Whether the review comment has been resolved.

Range:

  • true: Yes
  • false or null: No

is_outdated

Boolean

Explanation:

Whether the review comment is for the latest commit.

Range:

  • true: Yes
  • false or null: No
Table 7 PositionDto

Parameter

Type

Description

base_sha

String

Explanation:

Base commit node of the source branch.

Range:

40 digits and letters.

start_sha

String

Explanation:

Latest commit node of the source branch.

Range:

40 digits and letters.

head_sha

String

Explanation:

Latest commit node of the target branch.

Range:

40 digits and letters.

old_path

String

Explanation:

Old file path.

Range:

None

new_path

String

Explanation:

New file path.

Range:

None

position_type

String

Explanation:

Change type.

Range:

None

Default value:

text

old_line

Integer

Explanation:

Line number before change. If the value is less than or equal to 0 or is null, the line is new and displayed in green on the right for comparison.

Range:

–1 to 2147483647 or null

new_line

Integer

Explanation:

New line No.

If the value is less than or equal to 0 or is null, the line is deleted and displayed in red on the left for comparison.

Range:

–1 to 2147483647 or null

Table 8 UserBasicDto

Parameter

Type

Description

id

Integer

Explanation:

User ID.

Range:

Minimum value: 1

Maximum value: 2147483647

name

String

Explanation:

Name.

Range:

Max. 255 characters.

username

String

Explanation:

Username.

Range:

Max. 255 characters.

state

String

Explanation:

Status.

Range:

Max. 255 characters.

avatar_url

String

Explanation:

URL for obtaining the profile picture.

Range:

None

avatar_path

String

Explanation:

Path for obtaining the profile picture.

Range:

None

email

String

Explanation:

Email address.

Range:

None

name_cn

String

Explanation:

Chinese name.

Constraints:

The value is the same as that of username. This field has been discarded.

Range:

None

web_url

String

Explanation:

Homepage URL.

Range:

None

nick_name

String

Explanation:

Alias.

Range:

None

tenant_name

String

Explanation:

Tenant name.

Range:

None

Table 9 MergeRequestVersionParamsDto

Parameter

Type

Description

diff_id

Integer

Explanation:

Each MR version has a unique diff_id. (In this API, the MR version is the latest.)

Range:

Minimum value: 1

Maximum value: 2147483647

start_sha

String

Explanation:

Latest commit node of the target branch.

Range:

40 digits and letters.

commit_id

String

Explanation:

Associated commit ID: SHA value of a commit. This field applies when noteable_type is set to Commit.

Range:

40 digits and letters.

Example Requests

GET https://{endpoint}/v2/repositories/{repository_id}/merge_requests/{merge_request_iid}/discussions?type=user&page=1&per_page=20&unresolved=&view=basic

Example Responses

Status code: 200

OK

{
    "result": [
        {
            "id": "996f57b8fdd5e62678b16f0ea4f91688405fa72f",
            "individual_note": false,
            "notes": [
                {
                    "id": 2111974336,
                    "type": "DiffNote",
                    "body": "Review comment",
                    "author": {
                        "id": 9124,
                        "name": "CodeHub_beta_dev",
                        "username": "c369c68f1ff84679b5a8ed904d8bff1c",
                        "state": "active",
                        "avatar_url": "",
                        "email": "liujian@example.com",
                        "name_cn": "CodeHub_beta_dev",
                        "web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
                        "nick_name": "Alias",
                        "tenant_name": "devcloud_codehub_l00314597_01"
                    },
                    "created_at": "2024-07-29T22:01:37.000+08:00",
                    "updated_at": "2024-07-29T22:01:37.000+08:00",
                    "system": false,
                    "resolvable": true,
                    "is_reply": false,
                    "discussion_id": "996f57b8fdd5e62678b16f0ea4f91688405fa72f",
                    "archived": false,
                    "review_categories": "Type",
                    "review_categories_cn": "Type",
                    "review_categories_en": "Type",
                    "review_modules": "Module",
                    "severity": "suggestion",
                    "severity_cn": "Suggestion",
                    "severity_en": "Suggestion",
                    "assignee": {
                        "id": 9124,
                        "name": "CodeHub_beta_dev",
                        "username": "c369c68f1ff84679b5a8ed904d8bff1c",
                        "state": "active",
                        "avatar_url": "",
                        "email": "liujian@example.com",
                        "name_cn": "CodeHub_beta_dev",
                        "web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
                        "nick_name": "Alias",
                        "tenant_name": "devcloud_codehub_l00314597_01"
                    },
                    "proposer": {
                        "id": 9124,
                        "name": "CodeHub_beta_dev",
                        "username": "c369c68f1ff84679b5a8ed904d8bff1c",
                        "state": "active",
                        "avatar_url": "",
                        "email": "liujian@example.com",
                        "name_cn": "CodeHub_beta_dev",
                        "web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
                        "nick_name": "Alias",
                        "tenant_name": "devcloud_codehub_l00314597_01"
                    },
                    "position": {
                        "base_sha": "a9ce1513d5185d5fe2bac52c597f204ce695c4be",
                        "start_sha": "a9ce1513d5185d5fe2bac52c597f204ce695c4be",
                        "head_sha": "53c75fa88dc4e7d0b68d108b7f1ee0a5c4564f44",
                        "old_path": "a.txt",
                        "new_path": "a.txt",
                        "position_type": "text",
                        "new_line": 1
                    },
                    "resolved": false
                }
            ],
            "project_id": 2111704470,
            "noteable_type": "MergeRequest",
            "project_full_path": "sll_test00006/mr_test",
            "a_mode": "0",
            "b_mode": "100644",
            "deleted_file": false,
            "new_file": true,
            "resolved": false,
            "archived": false,
                    "review_categories": "Type",
            "review_categories_cn": "Type",
            "review_categories_en": "Type",
                    "review_modules": "Module",
            "severity": "suggestion",
            "severity_cn": "Suggestion",
            "severity_en": "Suggestion",
            "assignee": {
                "id": 9124,
                "name": "CodeHub_beta_dev",
                "username": "c369c68f1ff84679b5a8ed904d8bff1c",
                "state": "active",
                "avatar_url": "",
                "email": "liujian@example.com",
                "name_cn": "CodeHub_beta_dev",
                "web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
                        "nick_name": "Alias",
                "tenant_name": "devcloud_codehub_l00314597_01"
            },
            "proposer": {
                "id": 9124,
                "name": "CodeHub_beta_dev",
                "username": "c369c68f1ff84679b5a8ed904d8bff1c",
                "state": "active",
                "avatar_url": "",
                "email": "liujian@example.com",
                "name_cn": "CodeHub_beta_dev",
                "web_url": "https://test.com/c369c68f1ff84679b5a8ed904d8bff1c",
                        "nick_name": "Alias",
                "tenant_name": "devcloud_codehub_l00314597_01"
            },
            "merge_request_version_params": {}
        }
    ],
    "status": "success"
}

Status Codes

Status Code

Description

200

OK

Error codes

Status Code

Error Code

Error Message

Description

Measure

404

CH.00406001

MergeRequest Not Found

MR information is not found.

Refresh the MR page and try again.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback