List all members of the enterprise¶
GET /api/v8/enterprises/{enterprise}/members
Call this endpoint to list all members of the enterprise.
Supported access tokens¶
- AtomGit user access tokens
Anonymous access allowed¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
enterprise |
path | integer | Yes | Enterprise ID |
access_token |
query | string | Yes | User authorization code |
page |
query | integer | No | Current page number, default 1 |
per_page |
query | integer | No | Number of items per page, maximum 100, default 20 |
role |
query | string | No | Filter members by role; enum: all / admin / member |
Response parameters¶
The response body is a JSON array where each element represents an enterprise member.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
user |
object | Yes | No | User information of the member |
active |
boolean | Yes | No | Whether the member is active |
role |
string | Yes | No | Member role identifier |
role_name |
string | Yes | No | Member role name |
role_id |
string | Yes | No | Role ID |
role_name_cn |
string | Yes | No | Role name in Chinese |
enterprise_email |
string | No | Yes | Enterprise email of the member |
user object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
user.html_url |
string | Yes | No | URL of the user's profile page |
user.id |
string | Yes | No | User ID |
user.object_id |
string | Yes | No | User object ID |
user.login |
string | Yes | No | User login name |
user.name |
string | Yes | No | User name |
user.url |
string | Yes | No | User URL |
user.user_id |
string | Yes | No | User ID |
user.avatar_url |
string | Yes | No | URL of the user's avatar |
Error response¶
400 Invalid parameters
401 Unauthenticated
Error field names follow what the backend actually returns.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Invalid parameters |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
Request example¶
Parameter notes¶
Replace
<enterprise>with the enterprise ID and<token>with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v8/enterprises/<enterprise>/members?access_token=<token>&page=1&per_page=20&role=all' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const enterprise = "<enterprise>";
const token = "<YOUR-TOKEN>";
const url = new URL(`https://api.atomgit.com/api/v8/enterprises/${enterprise}/members`);
url.searchParams.set("access_token", token);
url.searchParams.set("page", "1");
url.searchParams.set("per_page", "20");
url.searchParams.set("role", "all");
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/v8/enterprises/<enterprise>/members",
params={
"access_token": "<YOUR-TOKEN>",
"page": 1,
"per_page": 20,
"role": "all",
},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"user": {
"html_url": "https://api.atomgit.com/u/octocat",
"id": "123456",
"object_id": "789012",
"login": "octocat",
"name": "Octo Cat",
"url": "https://api.atomgit.com/octocat",
"user_id": "123456",
"avatar_url": "https://api.atomgit.com/avatar.png"
},
"active": true,
"role": "member",
"role_name": "Member",
"role_id": "1",
"role_name_cn": "Member",
"enterprise_email": "octocat@atomgit.com"
}
]
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 |
404 |
Request path does not exist |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Note:
role_nameandrole_name_cnare localized display names returned in Chinese by the API, so the sample keeps the original values.
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc