Skip to content

List repositories starred by a user

GET /api/v5/users/{username}/starred

List the repositories starred by the specified user and return an array of repository objects (paginated).

Supported access tokens

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
username path string Yes Username (username/login, that is, the user's address path)
access_token query string Yes User authorization code
sort query string No Sort field, enum: created / last_push; sort by repository creation time (created) or last push time (last_push); default created (creation time)
direction query string No Sort direction, enum: asc / desc; default desc (descending)
page query integer No Current page number; default 1
per_page query integer No Number of items per page; maximum 100, default 30

Response parameters

Field Type Always returned Nullable Description
id integer Yes Yes Repository ID
full_name string Yes Yes Repository full path
human_name string Yes Yes Repository full name
url string Yes Yes Repository details URL
namespace object Yes Yes Namespace the repository belongs to
path string Yes Yes Repository path
name string Yes Yes Repository name
parentfull_name string Yes Yes Parent repository name
description string Yes Yes Repository description
status string Yes Yes Repository status: 0: start (repository not archived), 2: closed (repository archived)
ssh_url_to_repo string Yes Yes Repository SSH Git URL
http_url_to_repo string Yes Yes Repository HTTP Git URL
web_url string Yes Yes Repository web URL
created_at string Yes Yes Creation time
updated_at string Yes Yes Update time
homepage string Yes Yes Repository homepage
members string[] Yes Yes Member list
parent object Yes Yes Parent repository information (the repository this fork comes from)
forks_count integer Yes Yes Number of forks
stargazers_count integer Yes Yes Number of stars
relation string Yes Yes Role of the current user in the repository
permission object Yes Yes Permissions of the current user on the repository
internal boolean Yes Yes Whether it is internally open source
open_issues_count integer Yes Yes Number of open issues
has_issue boolean Yes Yes Whether the issue feature is enabled
has_issues boolean Yes Yes Whether issues exist
watchers_count integer Yes Yes Number of watchers
enterprise object Yes Yes Enterprise/namespace information
default_branch string Yes Yes Default branch
fork boolean Yes Yes Whether the repository is a fork
pushed_at string Yes Yes Time of the last code push
owner object Yes Yes Repository owner information
issue_template_source string Yes Yes Issue template source, enum: project (use the repository Issue Template as the template) / enterprise (use enterprise work items as the template)
project_creator string Yes Yes Repository creator
private boolean Yes Yes Whether the repository is private
public boolean Yes Yes Whether the repository is public

Note: The response body is an array of repository objects; the table above describes the fields of each array element (ProjectResp).

namespace object

Field Type Always returned Nullable Description
namespace.id integer Yes Yes Namespace ID
namespace.type string Yes Yes Namespace type (e.g. user)
namespace.name string Yes Yes Namespace name
namespace.path string Yes Yes Namespace path
namespace.html_url string Yes Yes Namespace HTML URL

parent object

Field Type Always returned Nullable Description
parent.full_name string Yes Yes Parent repository full path
parent.human_name string Yes Yes Parent repository full name

permission object

Field Type Always returned Nullable Description
permission.pull boolean Yes Yes Whether the user has pull permission
permission.push boolean Yes Yes Whether the user has push permission
permission.admin boolean Yes Yes Whether the user has admin permission

enterprise object

Field Type Always returned Nullable Description
enterprise.id integer Yes No Enterprise/namespace ID
enterprise.path string Yes Yes Enterprise/namespace path
enterprise.html_url string Yes Yes Enterprise/namespace HTML URL
enterprise.type string Yes Yes Type

owner object

Field Type Always returned Nullable Description
owner.id string Yes Yes Owner ID
owner.login string Yes Yes Login name
owner.name string Yes Yes Name
owner.type string Yes Yes Type (such as User)

Error response

The endpoint may return the following error responses. The actual field names returned by the backend take precedence:

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Parameter username cannot be empty"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

HTTP status codes

Status code Description
200 Success (OK)
304 Not modified
401 Requires authentication
403 Forbidden

Request example

Parameter notes

This endpoint allows anonymous access, so the example omits the access token; to read private data, pass the access_token query parameter or an authentication header.

<username> Replace with the username (username/login, that is, the user's address path).

cURL

curl -X GET 'https://api.atomgit.com/api/v5/users/<username>/starred?access_token=<token>&sort=created&direction=desc&page=1&per_page=30' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const username = "octocat";
const response = await fetch(
  `https://api.atomgit.com/api/v5/users/${username}/starred?access_token=<token>&sort=created&direction=desc&page=1&per_page=30`,
  {
    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/users/<username>/starred",
    params={
        "access_token": "<token>"
        "sort": "created",
        "direction": "desc",
        "page": 1,
        "per_page": 30,
    },
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": 777621,
    "full_name": "xiaogang/private-new2",
    "human_name": "xiaogang / private-new2",
    "url": "https://api.atomgit.com/api/v5/repos/xiaogang/private-new2",
    "namespace": {
      "id": 137117,
      "type": "user",
      "name": "xiaogang",
      "path": "xiaogang",
      "html_url": "https://api.atomgit.com/xiaogang"
    },
    "path": "private-new2",
    "name": "private-new2",
    "parentfull_name": "xiaogang_test/private-new",
    "description": "Trump",
    "status": "started",
    "ssh_url_to_repo": "ssh://git@atomgit.com:2222/xiaogang/private-new2.git",
    "http_url_to_repo": "https://api.atomgit.com/xiaogang/private-new2.git",
    "web_url": "https://api.atomgit.com/xiaogang/private-new2",
    "created_at": "2024-12-11T17:41:14.536+08:00",
    "updated_at": "2024-12-11T17:41:14.536+08:00",
    "homepage": "https://api.atomgit.com/xiaogang/private-new2",
    "members": [
      "xiaogang"
    ],
    "parent": {
      "full_name": "xiaogang_test/private-new",
      "human_name": "xiaogang_test / private-new"
    },
    "forks_count": 0,
    "stargazers_count": 1,
    "relation": "master",
    "permission": {
      "pull": true,
      "push": true,
      "admin": true
    },
    "internal": false,
    "open_issues_count": 0,
    "has_issue": false,
    "has_issues": false,
    "watchers_count": 0,
    "enterprise": {
      "id": 137117,
      "path": "xiaogang",
      "html_url": "https://api.atomgit.com/xiaogang",
      "type": "user"
    },
    "default_branch": "main",
    "fork": true,
    "pushed_at": "2024-12-20T19:14:34.979+08:00",
    "owner": {
      "id": "496",
      "login": "xiaogang",
      "name": "Xiao Gang",
      "type": "User"
    },
    "issue_template_source": "project",
    "project_creator": "xiaogang",
    "private": false,
    "public": true
  }
]

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access token)
400 Invalid parameters or unparseable request
404 Request path does not exist
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal system error

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