Skip to content

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 searching by title and description. It returns details such as the discussion title, author, category, labels, and comment count.

Access token support

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint allows anonymous access

Request parameters

Parameter Location Type Required Description
owner path string Yes Namespace path of the repository (the path of an enterprise, organization, or personal address)
repo path string Yes Repository path (path)
access_token query string No User authorization code (optional; anonymous access is allowed)
page query string No Current page number
per_page query string No Number of items per page, maximum 100, default 20
sort query string No Sort field: created (creation time), comment_size (comment count); default created
direction query string No Sort direction: asc (ascending) / desc (descending); default desc
search query string No Search by title and description

Response parameters

The response body is an array of discussion objects, each element corresponding to one discussion.

Field Type Always returned Nullable Description
id string Yes No Discussion ID
number integer Yes No Discussion number
title string Yes No Discussion title
created_at string Yes No Creation time
updated_at string Yes No Update time
author object Yes No Discussion author information
is_lock integer Yes No Whether locked
is_pin integer Yes No Whether pinned
is_category_pin integer Yes No Whether pinned within the type
is_closed integer Yes No Whether closed
is_answered integer Yes No Whether an answer is accepted
comment_total integer Yes No Comment count
category object Yes No Discussion category information
namespace object Yes No Owning namespace
labels object[] Yes No Label list

author object

Field Type Always returned Nullable Description
author.avatar_url string Yes No Avatar URL
author.id string Yes No User ID
author.object_id string Yes No User object ID
author.login string Yes No Login name
author.name string Yes No User name

category object

Field Type Always returned Nullable Description
category.id string Yes No Category ID
category.name string Yes No Category name
category.icon string Yes No Category icon
category.description string Yes No Category description
category.type integer Yes No Category type

namespace object

Field Type Always returned Nullable Description
namespace.id integer Yes No Namespace ID
namespace.kind string Yes No Namespace type
namespace.full_path string Yes No Namespace full path

labels object

Field Type Always returned Nullable Description
labels.id string Yes No Label ID
labels.name string Yes No Label name
labels.color string Yes No Label color
labels.created_at string Yes No Label creation time
labels.updated_at string Yes No Label update time

Error response

This endpoint allows anonymous access and normally returns 200. Below are examples of possible failure scenarios; the error field names are subject to what the backend actually returns.

400 Parameter error

{
  "error": "invalid_request",
  "message": "Invalid parameter"
}

404 Resource does not exist

{
  "error": "not_found",
  "message": "Repository or discussion does not exist"
}

HTTP response status codes

Status code Description
200 Success (OK)
304 Not modified
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)
404 Resource not found (Not found)

Request example

Parameter description

  • <owner> — Replace with the namespace path of the repository (the path of an enterprise, organization, or personal address);
  • <repo> — Replace with the repository path (path);
  • This endpoint allows anonymous access; you can also carry an access token to access non-public content.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss?per_page=20&sort=created&direction=desc' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss?per_page=20&sort=created&direction=desc",
  {
    headers: {
      "Accept": "application/json",
    },
  }
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss",
    params={"per_page": 20, "sort": "created", "direction": "desc"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": "123456",
    "number": 1,
    "title": "How do I integrate OAuth 2.0?",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-16T08:00:00Z",
    "author": {
      "avatar_url": "https://api.atomgit.com/assets/avatars/octocat.png",
      "id": "10001",
      "object_id": "abc123",
      "login": "octocat",
      "name": "Octo Cat"
    },
    "is_lock": 0,
    "is_pin": 0,
    "is_category_pin": 0,
    "is_closed": 0,
    "is_answered": 1,
    "comment_total": 3,
    "category": {
      "id": "cat-01",
      "name": "Problem feedback",
      "icon": "https://api.atomgit.com/assets/icons/issue.png",
      "description": "Problem feedback category",
      "type": 1
    },
    "namespace": {
      "id": 2001,
      "kind": "project",
      "full_path": "octocat/hello-world"
    },
    "labels": [
      {
        "id": "lab-01",
        "name": "bug",
        "color": "#d73a4a",
        "created_at": "2024-01-15T10:30:00Z",
        "updated_at": "2024-01-15T10:30:00Z"
      }
    ]
  }
]

Error codes

Error code Description
400 Parameter error or unparsable request
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
404 Request path does not exist or the resource does not exist
429 Too many requests; rate limit triggered
500 Internal server error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc