Get a member of the enterprise¶
GET /api/v8/enterprises/{enterprise}/members/{username}
Call this endpoint to get a member 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 |
username |
path | string | Yes | Username (username/login) |
access_token |
query | string | Yes | User authorization code |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
user |
object | Yes | No | User information of the member |
active |
boolean | Yes | No | Whether the member is activated |
role |
string | Yes | No | Member role |
role_name |
string | Yes | No | Role name |
role_id |
string | Yes | No | Role ID |
role_name_cn |
string | Yes | No | Role name in Chinese |
enterprise_email |
string | Yes | No | Enterprise email |
user object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
user.avatar_url |
string | Yes | No | URL of the avatar |
user.html_url |
string | Yes | No | URL of the profile page |
user.id |
string | Yes | No | User ID |
user.object_id |
string | Yes | No | Object ID |
user.login |
string | Yes | No | Login name (username/login) |
user.name |
string | Yes | No | Name |
user.url |
string | Yes | No | URL of the user's profile page |
user.user_id |
string | Yes | No | User ID |
Error response¶
A
200/success response alone is not enough: callers need to know what a failure looks like in order to write error handling.
400 Invalid parameters
{
"error": "invalid_request",
"message": "Parameter username cannot be empty",
"field": "username"
}
401 Unauthenticated
404 Resource does not exist
Error field names follow what the backend actually returns.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Invalid parameters (Bad request) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Resource does not exist (Not found) |
Request example¶
Parameter notes¶
Replace
<enterprise>with the enterprise ID,<username>with the member's username (username/login), and<token>with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v8/enterprises/<enterprise>/members/<username>?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v8/enterprises/<enterprise>/members/<username>?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/v8/enterprises/<enterprise>/members/<username>",
params={"access_token": "<token>"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"user": {
"avatar_url": "https://api.atomgit.com/avatars/octocat.png",
"html_url": "https://api.atomgit.com/octocat",
"id": "268",
"object_id": "268",
"login": "octocat",
"name": "Octocat",
"url": "https://api.atomgit.com/octocat",
"user_id": "268"
},
"active": true,
"role": "admin",
"role_name": "admin",
"role_id": "1",
"role_name_cn": "Administrator",
"enterprise_email": "octocat@example.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_name_cnis the role's Chinese display name and is returned in Chinese by the API, so the sample keeps the original value.
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc