Skip to content

Get a user's personal activity

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

Call this endpoint to get a user's personal activity (a list of events grouped by date).

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), such as dengmengmian
access_token query string Yes User authorization code
year query string No Year the events were created (yyyy), such as 2024
next query string No Start time of the next page (cursor), such as 2024-09-05T13:48:47.370Z

Response parameters

Field Type Always returned Nullable Description
events object Yes Yes List of events grouped by date; the key is the event date (such as 2024-08-27) and the value is an array of event objects
next string No Yes Start time of the next page (cursor), used for pagination

events.<date>[] event object

Field Type Always returned Nullable Description
action integer Yes Yes Action type code
action_name string Yes Yes Action name, such as pushed to
author object Yes Yes Activity author information
author_id integer Yes Yes Author ID
author_username string Yes Yes Author username
created_at string Yes Yes Activity creation time (ISO 8601), such as 2024-08-27T10:34:05.093Z
project object Yes Yes Associated project information
project_id integer Yes Yes Project ID
project_name string Yes Yes Project name, such as mactribe/midsommarcartoon
push_data object No Yes Push data; returned when the activity type is a push
_links object No Yes Related links

author object

Field Type Always returned Nullable Description
author.id integer Yes Yes Author ID
author.iam_id string Yes Yes IAM account ID
author.username string Yes Yes Username
author.state string Yes Yes Account state, such as active
author.avatar_url string Yes Yes Avatar URL
author.email string Yes Yes Email
author.name string Yes Yes Name
author.name_cn string Yes Yes Name in Chinese
author.web_url string Yes Yes URL of the profile page

project object

Field Type Always returned Nullable Description
project.main_repository_language string[] No Yes List of primary project languages
project.star_count integer Yes Yes Number of stars
project.forks_count integer Yes Yes Number of forks
project.develop_mode string Yes Yes Development mode, such as normal
project.stared boolean Yes Yes Whether the current user has starred this project

push_data object

Field Type Always returned Nullable Description
push_data.commit_count integer No Yes Number of commits
push_data.action string No Yes Action, such as pushed
push_data.ref_type string No Yes Reference type, such as branch
push_data.commit_from string No Yes Source commit SHA
push_data.commit_to string No Yes Target commit SHA
push_data.ref string No Yes Branch/reference name, for example main
push_data.commit_title string No Yes Commit title
Field Type Always returned Nullable Description
_links.project string No Yes Project URL
_links.action_type string No Yes Action type link

Error response

400 Invalid parameters

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

401 Unauthenticated

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

Note: The actual error field names follow what the backend returns.

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication
403 Forbidden
404 User not found

Request example

Parameter notes

<username> replace with the username (username/login, such as dengmengmian); <token> Replace with your AtomGit user access token; <year> (optional) replace with the year of the events to query, such as 2024.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/users/<username>/events?access_token=<token>&year=2024' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const username = "dengmengmian";
const token = "<YOUR-TOKEN>";
const url = `https://api.atomgit.com/api/v5/users/${username}/events?access_token=${token}&year=2024`;

const response = await fetch(url, {
  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>/events",
    params={
        "access_token": "<YOUR-TOKEN>",
        "year": "2024",
    },
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "events": {
    "2024-08-27": [
      {
        "action": 5,
        "action_name": "pushed to",
        "author": {
          "id": 704,
          "iam_id": "5c340cab034d455992541f00f9936fb4",
          "username": "dengmengmian",
          "state": "active",
          "avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/fa/fe/f32a9fecc53e890afbd48fd098b0f6c5f20f062581400c76c85e5baab3f0d5b2.png",
          "email": "",
          "name": "dengmengmian",
          "name_cn": "dengmengmian",
          "web_url": "https://api.atomgit.com/dengmengmian"
        },
        "author_id": 704,
        "author_username": "dengmengmian",
        "created_at": "2024-08-27T10:34:05.093Z",
        "project": {
          "main_repository_language": ["Java", "Python"],
          "star_count": 0,
          "forks_count": 0,
          "develop_mode": "normal",
          "stared": false
        },
        "project_id": 507167,
        "project_name": "mactribe/midsommarcartoon",
        "push_data": {
          "commit_count": 1,
          "action": "pushed",
          "ref_type": "branch",
          "commit_from": "2ce472fec073f77804c3480ccf128219a6172e54",
          "commit_to": "14b742fe434797fb073ba536804011f735f2f430",
          "ref": "main",
          "commit_title": "File title"
        },
        "_links": {
          "project": "https://api.atomgit.com/mactribe/midsommarcartoon",
          "action_type": ""
        }
      }
    ]
  },
  "next": "2024-08-01T10:10:40.370Z"
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access token)
400 Invalid parameters or unparseable request
404 Request path or user 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