Get repository activity¶
GET /api/v5/repos/{owner}/{repo}/events
This endpoint returns the list of activities (events) for the specified repository. You can filter by event type, author, and date range, and the response supports pagination and includes event details.
Access token support¶
- AtomGit user access tokens
Anonymous access¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Address of the namespace that owns the repository (the address path of the enterprise, organization, or personal namespace) |
repo |
path | string | Yes | Repository path (path) |
filter |
query | string | No | Filter condition. Pass all (all events), push (push events), merged (merged events), issue (issue events), comments (comment events), team (team events), or project (project events) |
author |
query | string | No | Event author; pass a username |
before |
query | string | No | Start date in YYYY-MM-DD format, which sets the earliest time of the events to return |
after |
query | string | No | End date in YYYY-MM-DD format, which sets the latest time of the events to return |
page |
query | integer | No | Current page number |
per_page |
query | integer | No | Number of items per page, up to 100. Defaults to 20 |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
events |
object[] | Yes | Yes | List of repository activity events |
has_next_page |
integer | Yes | — | Whether another page exists; a non-zero value means more events are available |
events object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
events.action |
integer | Yes | — | Event type code |
events.action_name |
string | Yes | — | Event type name, such as opened or push |
events.author |
object | Yes | — | Information about the event author |
events.author_id |
integer | Yes | — | Event author ID |
events.author_username |
string | Yes | — | Event author username |
events.created_at |
string | Yes | — | Event creation time |
events.project_id |
integer | Yes | — | Repository ID |
events.title |
string | Yes | — | Event title |
events.filter_sensitive |
integer | Yes | — | Whether sensitive information is filtered (0/1; the example may also return a boolean) |
events.author object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
events.author.id |
integer | Yes | — | User ID |
events.author.iam_id |
string | Yes | — | IAM user identifier |
events.author.username |
string | Yes | — | Username |
events.author.state |
string | Yes | — | User state, such as active |
events.author.email |
string | Yes | Yes | Email address; may be an empty string |
events.author.name |
string | Yes | — | User name |
events.author.name_cn |
string | Yes | Yes | User name in Chinese; may be an empty string |
events.author.web_url |
string | Yes | — | User homepage URL |
Error response¶
A
200/success response alone is not enough: callers need to know what a failure looks like so they can write error handling.
The following are generic failure responses at the gateway/framework level; the actual error field names depend on what the backend returns:
400 Invalid parameters
401 Unauthenticated
404 Repository not found
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Succeeded (OK) |
400 |
Invalid parameters (Bad request) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Repository not found (Not found) |
Request example¶
Parameter notes¶
- Replace
<owner>with the address of the namespace that owns the repository (the address path of the enterprise, organization, or personal namespace). - Replace
<repo>with the repository path (path).
This endpoint allows anonymous access, so the examples do not need to carry an access token. If needed, you can also pass an AtomGit user access token through the access_token query parameter.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/events?per_page=20' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/events", {
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>/events",
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"events": [
{
"action": 22,
"action_name": "opened",
"author": {
"id": 607,
"iam_id": "f09ca8d721eb49e4add47b67c0dbef81",
"username": "xiaogang",
"state": "active",
"email": "",
"name": "xiaogang",
"name_cn": "",
"web_url": "https://api.atomgit.com/xiaogang"
},
"author_id": 607,
"author_username": "xiaogang",
"created_at": "2024-11-19T07:01:02.714Z",
"project_id": 249609,
"title": "{\"userid\":[496],\"username\":[\"xiaogang\"]}",
"filter_sensitive": 0
}
],
"has_next_page": 0
}
Error codes¶
| Error code | Description |
|---|---|
400 |
Invalid parameters, or the request cannot be parsed |
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
403 |
Access forbidden (no permission) |
404 |
The request path does not exist |
405 |
The request method is 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