Discussions¶
Discussions are used to start topics and gather opinions within a repository or organization. The API lets you create, update, and delete discussions under a repository or organization, manage comments and replies to comments, and filter the list by category, title, and popularity.
The repository and organization endpoints are symmetric; their parameters differ only in the scope identifier.
Objects¶
| Object | Description | Related endpoints |
|---|---|---|
| Repository discussion | Title, body, category, labels, comment count | Create repository discussion |
| Organization discussion | A discussion under an organization namespace; fields are the same as a repository discussion | Create organization discussion |
| Comment | A comment under a discussion; the body supports Markdown | Create repository discussion comment |
| Reply | A reply to a comment, located by comment ID | Reply to repository discussion comment |
| Category | The category the discussion belongs to, specified on create and update | Update repository discussion |
| Vote | The vote and vote options returned in the discussion details (read-only) | Get project discussion details |
Identification¶
- Repository discussions use
owner+repoto identify the repository andnumberto identify the discussion number; the path segment isdiscuss. - Organization discussions use
orgto identify the organization, and the number also usesnumber. - Comments are identified by
id(written ascomment_idon the organization side); the reply path iscomment/{id}/reply.
Common tasks¶
| Task | Endpoint |
|---|---|
| Create repository discussion | POST /api/v5/repos/{owner}/{repo}/discuss |
| Get repository discussion list | GET /api/v5/repos/{owner}/{repo}/discuss |
| Get repository discussion details | GET /api/v5/repos/{owner}/{repo}/discuss/{number} |
| Update / delete repository discussion | PUT / DELETE /api/v5/repos/{owner}/{repo}/discuss/{number} |
| Create comment | POST /api/v5/repos/{owner}/{repo}/discuss/{number}/comment |
| Reply to comment | POST /api/v5/repos/{owner}/{repo}/discuss/{number}/comment/{id}/reply |
| Create organization discussion | POST /api/v5/orgs/{org}/discuss |
| Get organization discussion list | GET /api/v5/orgs/{org}/discuss |
| List organization discussion comments | GET /api/v5/orgs/{org}/discuss/{number}/comment |
Notes¶
- The path segment is
discuss(notdiscussions), the comment segment is the singularcomment, and replies usecomment/{id}/reply; a single missing letter returns 404. - The endpoint path for getting the repository discussion comment reply list uses
*placeholders:GET /api/v5/repos/*/*/discuss/*/comment/*/reply, which is inconsistent with the{owner}/{repo}style used by the rest of the group. - Repository discussions and organization discussions are two separate sets of endpoints;
/repos/{owner}/{repo}/discuss…and/orgs/{org}/discuss…cannot be used interchangeably. - The body of both comments and replies supports Markdown; submit the raw Markdown text.
- The details endpoint returns the vote and vote options, but this group has no endpoint for creating votes or writing labels; these two fields are read-only.
Endpoints¶
This module contains 22 endpoints.
| # | Endpoint | Method and path | Description |
|---|---|---|---|
| 1 | Create repository discussion | POST /api/v5/repos/{owner}/{repo}/discuss |
This endpoint creates a new discussion in the specified repository. The request must provide the discussion title, discussion content, and category. On success, it returns the discussion number, title, content... |
| 2 | Update repository discussion | PUT /api/v5/repos/{owner}/{repo}/discuss/{number} |
This endpoint updates a discussion in the specified repository. You can change the discussion title, content, and category, and it returns the complete discussion information. |
| 3 | Delete repository discussion | DELETE /api/v5/repos/{owner}/{repo}/discuss/{number} |
This endpoint deletes a discussion in the specified repository. It locates the target discussion by the namespace path the repository belongs to, the repository path, and the discussion number, and returns an empty response body on success. |
| 4 | Create repository discussion comment | POST /api/v5/repos/{owner}/{repo}/discuss/{number}/comment |
This endpoint creates a comment under a discussion in the specified repository. It accepts the comment content in Markdown format and returns the newly created comment along with its author, discussion... |
| 5 | Reply to repository discussion comment | POST /api/v5/repos/{owner}/{repo}/discuss/{number}/comment/{id}/reply |
This endpoint replies to a specific comment in a discussion in the specified repository. You submit the comment content in Markdown format to complete the reply, and returns the created... |
| 6 | Update repository discussion comment | PUT /api/v5/repos/{owner}/{repo}/discuss/{number}/comment/{id} |
This endpoint updates the content of a comment under a discussion in the specified repository. It accepts new comment content in Markdown format and returns the updated comment details... |
| 7 | Delete repository discussion comment | DELETE /api/v5/repos/{owner}/{repo}/discuss/{number}/comment/{id} |
This endpoint deletes a specified comment under a discussion in the specified repository. On success, no response body is returned. |
| 8 | Get project discussion list | GET /api/v5/repos/{owner}/{repo}/discuss |
This endpoint gets the project discussion list for the specified repository. It supports pagination by page number and per-page count, sorting by creation time or comment count in ascending or descending order, and can also... |
| 9 | Get project discussion details | GET /api/v5/repos/{owner}/{repo}/discuss/{number} |
This endpoint gets the details of a discussion in the specified repository. It returns the discussion title, body content, author information, category, labels, comment total, and the vote and vote... |
| 10 | Get project discussion comment list | GET /api/v5/repos/{owner}/{repo}/discuss/{number}/comment |
This endpoint gets the comment list under a project discussion in the specified repository. It supports paginated queries by page number and per-page count and can sort by comment creation time or popularity, and... |
| 11 | Get project discussion comment reply list | GET /api/v5/repos/*/*/discuss/*/comment/*/reply |
This endpoint gets the comment reply list of a project discussion in the specified repository. It returns data such as the reply content, author information, and like count, and supports paginated queries. |
| 12 | Create organization discussion | POST /api/v5/orgs/{org}/discuss |
This endpoint creates a new discussion under the specified organization. The request must provide the discussion title, discussion content (in Markdown format), and category name; on success... |
| 13 | Update organization discussion | PUT /api/v5/orgs/{org}/discuss/{number} |
This endpoint updates the content of a discussion in the specified organization. You can change the discussion title, body content (in Markdown format), and category, and returns the updated... |
| 14 | Delete organization discussion | DELETE /api/v5/orgs/{org}/discuss/{number} |
This endpoint deletes a discussion under the specified organization. It locates the target discussion by organization path and discussion number, and returns status code 200 with an empty response body on success. |
| 15 | Create organization discussion comment | POST /api/v5/orgs/{org}/discuss/{number}/comment |
This endpoint creates a comment under a discussion in the specified organization. It requires the organization path, discussion number, and comment content in Markdown format; on success, it returns... |
| 16 | Reply to organization discussion comment | POST /api/v5/orgs/{org}/discuss/{number}/comment/{id}/reply |
This endpoint replies to a discussion comment under the specified organization. It accepts reply content in Markdown format and returns details of the created reply (such as the reply... |
| 17 | Update organization discussion comment | PUT /api/v5/orgs/{org}/discuss/{number}/comment/{id} |
This endpoint updates the content of a comment under a discussion in the specified organization. Submit the new comment content in Markdown format to complete the update, and returns the updated comment... |
| 18 | Delete organization discussion comment | DELETE /api/v5/orgs/{org}/discuss/{number}/comment/{id} |
This endpoint deletes a comment under a discussion in the specified organization. You specify the organization path, discussion number, and comment id; on success it returns status code 200 with an empty response body. |
| 19 | Get organization discussion list | GET /api/v5/orgs/{org}/discuss |
This endpoint gets the discussion list for the specified organization. It supports paginated queries by page number and per-page count, sorting by creation time or comment count, and can search by title and description... |
| 20 | Get organization discussion details | GET /api/v5/orgs/{org}/discuss/{number} |
This endpoint gets the details of a discussion in the specified organization by organization path and discussion number. It returns the discussion title, body content, author information, category, comment count, vote information, and... |
| 21 | Get organization discussion comment list | GET /api/v5/orgs/{org}/discuss/{number}/comment |
This endpoint gets the comment list of a discussion under the specified organization. It supports pagination and sorting by creation time or popularity, and the returned content includes the comment content, like count, reply count, and... |
| 22 | Get organization discussion comment reply list | GET /api/v5/orgs/{org}/discuss/{number}/comment/{comment_id}/reply |
This endpoint gets the reply list of a comment under a discussion in the specified organization. It returns details for each reply such as the author information, content and Markdown-formatted content, like count, and... |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc