Skip to content

List repositories watched by a user

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

Call this endpoint to list the repositories the specified user is watching (that is, the list of repositories the user is subscribed to).

Supported access tokens

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint allows anonymous access.

Request parameters

Parameter Location Type Required Description
username path string Yes Username (user namespace address path)
access_token query string No User authorization code
sort query string No Sort order: created by creation time, last_push by last push time; default created
direction query string No Sort direction: asc / desc; default desc
page query integer No Current page number
per_page query integer No Number of items per page; maximum 100, default 20

Response parameters

The response body is an array of "repositories watched by the user" objects; the fields of each array element are listed below:

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

namespace object

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

parent object

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

permission object

Field Type Always returned Nullable Description
permission.pull integer Yes No Pull permission
permission.push integer Yes No Push permission
permission.admin integer Yes No Admin permission

enterprise object

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

owner object

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

Error response

400 Invalid parameters

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

401 Unauthenticated

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

The actual error field names returned by the backend take precedence.

HTTP status codes

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

Request example

Parameter notes

Replace <username> with the username (user namespace address path). This endpoint allows anonymous access and also accepts <token> (an AtomGit user access token) to read a private watch list; sort accepts created / last_push, and direction accepts asc / desc.

cURL

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

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/users/<username>/subscriptions?sort=created&direction=desc&page=1&per_page=20",
  {
    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>/subscriptions",
    params={"sort": "created", "direction": "desc", "page": 1, "per_page": 20},
    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": "Example repository",
    "status": "0",
    "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": 1,
      "push": 1,
      "admin": 1
    },
    "internal": 0,
    "open_issues_count": 0,
    "has_issue": 0,
    "has_issues": 0,
    "watchers_count": 0,
    "enterprise": {
      "id": 137117,
      "path": "xiaogang",
      "html_url": "https://api.atomgit.com/xiaogang",
      "type": "user"
    },
    "default_branch": "main",
    "fork": 1,
    "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": 0,
    "public": 1
  }
]

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