Search users¶
GET /api/v5/search/users
Call this endpoint to search users by keyword.
Access token support¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
q |
query | string | Yes | Search keyword |
access_token |
query | string | No | User authorization code |
page |
query | integer | No | Current page number, maximum 100 |
per_page |
query | integer | No | Number of items per page, maximum 50 |
sort |
query | string | No | Sort field; joined_at (registration time); defaults to best match |
order |
query | string | No | Sort order (default: desc) |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
avatar_url |
string | Yes | — | User avatar URL |
created_at |
string | Yes | — | User creation time |
html_url |
string | Yes | — | User homepage URL |
id |
string | Yes | — | User ID |
login |
string | Yes | — | User login name |
name |
string | Yes | — | User name |
Note: The response body is an array of user objects; each element contains the fields in the table above.
Error responses¶
This endpoint has no business error response.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Request path does not exist |
500 |
Internal system error |
Request example¶
Parameter description¶
Replace
<keyword>with the keyword to search;pageis the current page number (maximum 100);per_pageis the number of items per page (maximum 50);sortis the sort field (joined_atsorts by registration time; the default is best match);orderis the sort order (defaultdesc).This endpoint allows anonymous access; no access token is required. To authenticate, append
access_token=<token>to the query parameters.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/search/users?q=<keyword>&page=1&per_page=20&sort=joined_at&order=desc' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const url = new URL("https://api.atomgit.com/api/v5/search/users");
url.searchParams.set("q", "<keyword>");
url.searchParams.set("page", "1");
url.searchParams.set("per_page", "20");
url.searchParams.set("sort", "joined_at");
url.searchParams.set("order", "desc");
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
params = {
"q": "<keyword>",
"page": 1,
"per_page": 20,
"sort": "joined_at",
"order": "desc",
}
resp = requests.get(
"https://api.atomgit.com/api/v5/search/users",
params=params,
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"avatar_url": "https://api.atomgit.com/avatar/wu_com.png",
"created_at": "2024-11-15T00:00:00+08:00",
"html_url": "https://api.atomgit.com/wu_com",
"id": "25235036",
"login": "wu_com",
"name": "wu_com"
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credential) |
400 |
Invalid parameters or the request cannot be parsed |
404 |
Request path 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