Get a user's public repositories¶
GET /api/v5/users/{username}/repos
Call this endpoint to get a user's public repositories.
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) |
access_token |
query | string | Yes | User authorization code |
type |
query | string | No | Repository type: repositories created by the user (owner), the user's personal repositories (personal), repositories the user is a member of (member), all (all); default all |
sort |
query | string | No | Sort order: Creation time(created), Update time(updated), last push time (pushed), repository owner and name (full_name); default full_name |
direction |
query | string | No | Sort direction: ascending (asc) when sort is full_name, otherwise descending (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 repository objects, where each element describes one public repository of the user.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Repository ID |
full_name |
string | Yes | No | Repository full name, in the form owner/name |
human_name |
string | Yes | No | Repository readable name, in the form owner / name |
url |
string | Yes | No | Repository API URL |
namespace |
object | Yes | No | Namespace the repository belongs to (enterprise, organization, or personal) |
path |
string | Yes | No | Repository path |
name |
string | Yes | No | Repository name |
description |
string | No | Yes | Repository description |
status |
string | Yes | No | Repository status: 0 start (repository not archived), 2 closed (repository archived) |
ssh_url_to_repo |
string | No | Yes | Repository SSH clone URL |
http_url_to_repo |
string | No | Yes | Repository HTTP clone URL |
web_url |
string | No | Yes | Repository web URL |
homepage |
string | No | Yes | Repository homepage |
members |
string[] | No | Yes | Repository member list |
assignee |
array | No | Yes | Repository collaborator list |
forks_count |
integer | Yes | No | Number of forks |
stargazers_count |
integer | Yes | No | Number of stars |
project_labels |
array | No | Yes | Repository label list |
relation |
string | No | Yes | Relation of the current user to the repository |
permission |
object | No | Yes | Permissions of the current user on the repository |
internal |
integer | Yes | No | Whether the repository is internal (boolean in the response example) |
open_issues_count |
integer | Yes | No | Number of open issues |
has_issue |
integer | Yes | No | Whether the issue feature is enabled (boolean in the response example) |
watched |
integer | Yes | No | Whether the current user is watching the repository (boolean in the response example) |
watchers_count |
integer | Yes | No | Number of followers |
assignees_number |
integer | Yes | No | Number of collaborators |
enterprise |
object | No | Yes | Enterprise/namespace information |
default_branch |
string | No | Yes | Default branch |
fork |
integer | Yes | No | Whether the repository is a fork (boolean in the response example) |
owner |
object | Yes | No | Repository owner |
assigner |
object | No | Yes | Repository assigner |
issue_template_source |
string | No | Yes | Issue template source |
private |
integer | Yes | No | Whether the repository is private (boolean in the response example) |
public |
integer | Yes | No | Whether the repository is public (boolean in the response example) |
gitee |
object | No | Yes | Gitee sync information |
namespace object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
namespace.id |
integer | Yes | No | Namespace ID |
namespace.type |
string | Yes | No | Namespace type, such as user / group / enterprise |
namespace.name |
string | Yes | No | Namespace name |
namespace.path |
string | Yes | No | Namespace path |
namespace.html_url |
string | Yes | No | Namespace web URL |
assignee array element object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
assignee.id |
string | Yes | No | User ID |
assignee.login |
string | Yes | No | Login name |
assignee.name |
string | Yes | No | Username |
assignee.avatar_url |
string | Yes | No | Avatar URL |
assignee.html_url |
string | Yes | No | User profile URL |
assignee.type |
string | Yes | No | User type, for example User |
permission object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
permission.pull |
integer | Yes | No | Pull permission (boolean in the response example) |
permission.push |
integer | Yes | No | Push permission (boolean in the response example) |
permission.admin |
integer | Yes | No | Admin permission (boolean in the response example) |
enterprise object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
enterprise.id |
integer | Yes | No | Namespace ID |
enterprise.path |
string | Yes | No | Namespace path |
enterprise.html_url |
string | Yes | No | Namespace web URL |
enterprise.type |
string | Yes | No | Namespace type |
owner object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
owner.id |
string | Yes | No | User ID |
owner.login |
string | Yes | No | Login name |
owner.name |
string | Yes | No | Username |
owner.type |
string | Yes | No | User type, for example User |
assigner object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
assigner.id |
string | Yes | No | User ID |
assigner.login |
string | Yes | No | Login name |
assigner.name |
string | Yes | No | Username |
assigner.type |
string | Yes | No | User type, for example User |
gitee object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
gitee.star |
integer | Yes | No | Number of Gitee stars |
gitee.fork |
integer | Yes | No | Number of Gitee forks |
gitee.watch |
integer | Yes | No | Number of Gitee watchers |
Each element of project_labels is an object, whose internal structure follows the actual response.
Error response¶
The field structure of the error response body follows what the backend actually returns; the following are common examples.
400 Invalid parameters
{
"error": "invalid_request",
"message": "Parameter username cannot be empty",
"field": "username"
}
401 Unauthenticated
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Request path does not exist |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Request example¶
Parameter notes¶
<username>replace with the target user's username (username/login);<token>Replace with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/users/<username>/repos?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/users/<username>/repos?access_token=<token>", {
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>/repos",
params={"access_token": "<token>"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 2734882,
"full_name": "dengmengmian/manifest",
"human_name": "dengmengmian / manifest",
"url": "https://api.atomgit.com/api/v5/repos/dengmengmian/manifest",
"namespace": {
"id": 199940,
"type": "user",
"name": "dengmengmian",
"path": "dengmengmian",
"html_url": "https://api.atomgit.com/dengmengmian"
},
"path": "manifest",
"name": "manifest",
"description": "manifest",
"status": "started",
"ssh_url_to_repo": "git@atomgit.com:dengmengmian/manifest.git",
"http_url_to_repo": "https://api.atomgit.com/dengmengmian/manifest.git",
"web_url": "https://api.atomgit.com/dengmengmian/manifest",
"homepage": "https://api.atomgit.com/dengmengmian/manifest",
"members": ["dengmengmian"],
"assignee": [
{
"id": "268",
"login": "dengmengmian",
"name": "Ma Fan",
"avatar_url": "https://cdn-img.atomgit.com/ec/fb/430ecf07b9ee91bbbbf341d92a36783d06e69086f82ce8cf5a6406f79f1c9cf4.png",
"html_url": "https://api.atomgit.com/dengmengmian",
"type": "User"
}
],
"forks_count": 0,
"stargazers_count": 0,
"project_labels": [],
"relation": "master",
"permission": {
"pull": true,
"push": true,
"admin": true
},
"internal": false,
"open_issues_count": 0,
"has_issue": false,
"watched": false,
"watchers_count": 0,
"assignees_number": 1,
"enterprise": {
"id": 199940,
"path": "dengmengmian",
"html_url": "https://api.atomgit.com/dengmengmian",
"type": "user"
},
"default_branch": "master",
"fork": false,
"owner": {
"id": "268",
"login": "dengmengmian",
"name": "Ma Fan",
"type": "User"
},
"assigner": {
"id": "268",
"login": "dengmengmian",
"name": "Ma Fan",
"type": "User"
},
"issue_template_source": "project",
"private": false,
"public": true,
"gitee": {
"star": 10,
"fork": 15,
"watch": 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