REST API v1 · למפתחים · מדריך עיון ל-API
מדריך עיון ל-API: שרת
כל 4 נקודות הקצה של שרת ב-REST API v1 של BotGG: הרשאות, פרמטרים, שדות, שגיאות ודוגמאות מוכנות ב-curl, JavaScript ו-Python.
תיעוד למפתחים
בעמוד הזה
נקודות קצה
הנתיבים יחסיים ל-https://console.botgg.app/api/v1. שלחו את מפתח ה-API בכותרת Authorization: Bearer botgg_…; מזהים הם מחרוזות.
| נקודת קצה | הרשאה | תיאור |
|---|---|---|
GET/guilds/{guildId} | guild:read | Get the server |
GET/guilds/{guildId}/roles | guild:read | List roles |
GET/guilds/{guildId}/channels | guild:read | List channels |
GET/guilds/{guildId}/members/{userId} | guild:read | Get a member |
מלבד השגיאות הייחודיות שלה (בהמשך), כל נקודת קצה יכולה להחזיר את השגיאות הכלליות האלה:
Get the server
GET/guilds/{guildId}
Name, icon, approximate member count, the bot’s language and the enabled BotGG features.
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
id | string | כן | |
name | string | כן | |
icon | string | null | כן | |
iconUrl | string | null | כן | |
memberCount | integer | null | כן | Approximate; null when Discord is unreachable |
locale | string | כן | The bot’s language on this server (en, ru, he) |
enabledFeatures | array of string | כן |
{
"id": "example",
"name": "Example",
"icon": "example",
"iconUrl": "https://example.com",
"memberCount": 10,
"locale": "example",
"enabledFeatures": [
"example"
]
}דוגמאות
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678" \
-H "Authorization: Bearer $BOTGG_API_KEY"// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
רק השגיאות הכלליות שמפורטות תחת „נקודות קצה”.
List roles
GET/guilds/{guildId}/roles
Highest first (Discord order), without @everyone.
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
items | array of object | כן | |
items[].id | string | כן | |
items[].name | string | כן | |
items[].color | string | null | כן | |
items[].position | integer | כן | |
items[].managed | boolean | כן | |
items[].hoist | boolean | כן | |
items[].mentionable | boolean | כן |
{
"items": [
{
"id": "example",
"name": "Example",
"color": "#18d7ff",
"position": 10,
"managed": true,
"hoist": true,
"mentionable": true
}
]
}דוגמאות
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/roles" \
-H "Authorization: Bearer $BOTGG_API_KEY"// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/roles', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/roles",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
| HTTP | קודים |
|---|---|
| 503 | SERVICE_UNAVAILABLE |
List channels
GET/guilds/{guildId}/channels
In Discord’s sidebar order (categories followed by their channels); threads are not included.
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
items | array of object | כן | |
items[].id | string | כן | |
items[].name | string | כן | |
items[].type | string | כן | אחד מ: text, voice, category, announcement, stage, forum, media, other |
items[].parentId | string | null | כן | |
items[].position | integer | כן |
{
"items": [
{
"id": "example",
"name": "Example",
"type": "text",
"parentId": "234567890123456789",
"position": 10
}
]
}דוגמאות
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/channels" \
-H "Authorization: Bearer $BOTGG_API_KEY"// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/channels', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/channels",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
| HTTP | קודים |
|---|---|
| 503 | SERVICE_UNAVAILABLE |
Get a member
GET/guilds/{guildId}/members/{userId}
Basic member info: names, avatar, role ids and join date. Cached for up to 5 minutes.
| שם | מיקום | סוג | חובה | תיאור |
|---|---|---|---|---|
guildId | נתיב | string | כן | המזהה של השרת שלכם · מזהה דיסקורד (מחרוזת) |
userId | נתיב | string | כן | מזהה הדיסקורד של החבר/ה · מזהה דיסקורד (מחרוזת) |
תשובה
| שדה | סוג | חובה | תיאור |
|---|---|---|---|
userId | string | כן | |
username | string | null | כן | |
globalName | string | null | כן | |
nickname | string | null | כן | |
displayName | string | null | כן | |
avatarUrl | string | null | כן | |
bot | boolean | כן | |
roles | array of string | כן | Role ids |
joinedAt | string | null | כן |
{
"userId": "876543210987654321",
"username": "example",
"globalName": "example",
"nickname": "example",
"displayName": "example",
"avatarUrl": "https://example.com",
"bot": false,
"roles": [
"example"
],
"joinedAt": "2026-10-07T12:00:00.000Z"
}דוגמאות
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/members/876543210987654321" \
-H "Authorization: Bearer $BOTGG_API_KEY"// Node.js 18+ (built-in fetch) — on your server, never in a browser
const res = await fetch('https://console.botgg.app/api/v1/guilds/123456789012345678/members/876543210987654321', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://console.botgg.app/api/v1/guilds/123456789012345678/members/876543210987654321",
headers={
"Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
},
timeout=10,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)שגיאות
| HTTP | קודים |
|---|---|
| 404 | MEMBER_NOT_FOUND |
| 503 | SERVICE_UNAVAILABLE |