Skip to content

List the organizations a user belongs to

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

Call this endpoint to list the organizations that the specified user belongs to.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
username path string Yes User name (username/login)
access_token query string Yes User authorization code
page query string No Current page number; defaults to 1
per_page query string No Number of items per page; defaults to 20, maximum 100

Response parameters

The response body is an array of organization objects. Each array element represents one organization that the user belongs to.

org object (array element)

Field Type Always returned Nullable Description
id integer Yes No Organization ID
login string Yes No Organization path name (path/login)
name string Yes No Organization name
avatar_url string Yes Yes Organization avatar URL
repos_url string Yes Yes Repository URL
events_url string Yes Yes Events URL
members_url string Yes Yes Members URL
description string Yes No Organization description
follow_count integer Yes No Number of followers

Error responses

400 Parameter error

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

401 Unauthenticated

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

HTTP response status codes

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

Request example

Parameter description

Replace <username> with the user name to query (username/login); replace <token> with your AtomGit user access token.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/users/<username>/orgs?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>/orgs?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>/orgs',
    params={'access_token': '<token>'},
    headers={'Accept': 'application/json'},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": 133039,
    "login": "openharmony",
    "name": "OpenHarmony",
    "avatar_url": null,
    "repos_url": null,
    "events_url": null,
    "members_url": null,
    "description": "OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation.",
    "follow_count": 3
  }
]

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
400 Parameter error or the request cannot be parsed
404 The request path does not exist
405 The request method is not supported
429 Too many requests; the rate limit was triggered
500 Internal system error

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