Update the profile of an organization managed by the authorized user¶
PATCH /api/v5/orgs/{org}
This endpoint updates the profile of an organization managed by the authorized user, such as the organization name, public email, location, description, and website. Use this endpoint to keep the organization profile accurate and up to date.
Access token support¶
- AtomGit user access tokens
Anonymous access¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
org |
path | string | Yes | Organization path (path/login) |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is an optional JSON object; all fields are optional.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": {
"description": "Organization name",
"type": "string"
},
"email": {
"description": "Public email address of the organization",
"type": "string"
},
"location": {
"description": "Location of the organization",
"type": "string"
},
"description": {
"description": "Organization description",
"type": "string"
},
"html_url": {
"description": "Organization website",
"type": "string"
}
},
"required": []
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
email |
string | Yes | No | Public email address of the organization |
name |
string | Yes | No | Organization name |
description |
string | Yes | No | Organization description |
html_url |
string | Yes | No | Organization website |
id |
integer | Yes | No | Organization ID |
path |
string | Yes | No | Organization path (path/login) |
Error responses¶
400 Parameter error
401 Unauthenticated
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Requires authentication |
403 |
Forbidden |
Request example¶
Parameter description¶
Replace
<org>with the organization path name (the address path of an enterprise, organization, or user); replace<token>with your AtomGit user access token.
cURL¶
curl -X PATCH 'https://api.atomgit.com/api/v5/orgs/<org>?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"name": "Organization",
"email": "123@qq.com",
"location": "Beijing",
"description": "233333",
"html_url": "www.baidu.com"
}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/orgs/<org>?access_token=<token>", {
method: "PATCH",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Organization",
email: "123@qq.com",
location: "Beijing",
description: "233333",
html_url: "www.baidu.com",
}),
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.patch(
"https://api.atomgit.com/api/v5/orgs/<org>",
params={"access_token": "<token>"},
headers={
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"name": "Organization",
"email": "123@qq.com",
"location": "Beijing",
"description": "233333",
"html_url": "www.baidu.com",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"email": "123@qq.com",
"name": "Organization",
"description": "233333",
"html_url": "www.baidu.com",
"id": 138108,
"path": "xiaogang444"
}
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