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}/applications/formsapplications:readList application forms
GET/guilds/{guildId}/applications/submissionsapplications:readList applications
GET/guilds/{guildId}/applications/submissions/{number}applications:readGet an application
POST/guilds/{guildId}/applications/submissions/{number}/decisionapplications:writeAccept or deny an application

מלבד השגיאות הייחודיות שלה (בהמשך), כל נקודת קצה יכולה להחזיר את השגיאות הכלליות האלה:

List application forms

GET/guilds/{guildId}/applications/forms

הרשאה: applications:read

In the console’s order, with their questions and submission counts.

נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: מועמדויות

פרמטרים
שםמיקוםסוגחובהתיאור
guildIdנתיבstringכןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)

תשובה

שדות התשובה · 200
שדהסוגחובהתיאור
itemsarray of objectכן
items[].idintegerכן
items[].titlestringכן
items[].descriptionstringכן
items[].openbooleanכןThe open toggle (the open window is in opensAt / closesAt)
items[].opensAtstring | nullכןISO 8601 date-time
items[].closesAtstring | nullכןISO 8601 date-time
items[].questionsarray of objectכן
items[].questions[].idstringכן
items[].questions[].typestringכן
items[].questions[].labelstringכן
items[].questions[].requiredbooleanכן
items[].submissionsobjectכן
items[].submissions.totalintegerכן
items[].submissions.openintegerכן
תשובה · 200
{
  "items": [
    {
      "id": 98765,
      "title": "example",
      "description": "example",
      "open": true,
      "opensAt": "2026-10-07T12:00:00.000Z",
      "closesAt": "2026-10-07T12:00:00.000Z",
      "questions": [
        {
          "id": "example",
          "type": "example",
          "label": "Example",
          "required": true
        }
      ],
      "submissions": {
        "total": 10,
        "open": 10
      }
    }
  ]
}

דוגמאות

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/forms" \
  -H "Authorization: Bearer $BOTGG_API_KEY"
JavaScript (fetch)
// 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/applications/forms', {
  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);
Python (requests)
import os
import requests

res = requests.get(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/forms",
    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קודים
409FEATURE_DISABLED
503SERVICE_UNAVAILABLE

List applications

GET/guilds/{guildId}/applications/submissions

הרשאה: applications:read

Newest first, without answers. status=open = pending + interview + hold, decided = accepted + denied. Pass before=<nextCursor> for the next page.

נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: מועמדויות

פרמטרים
שםמיקוםסוגחובהתיאור
guildIdנתיבstringכןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)
statusquerystringלאאחד מ: pending, interview, hold, accepted, denied, withdrawn, open, decided
formIdqueryintegerלאלפחות 1
userIdquerystringלאOnly this applicant
מזהה דיסקורד (מחרוזת)
limitqueryintegerלא1–100 · ברירת מחדל 25
beforequeryintegerלא1–999,999,999

תשובה

שדות התשובה · 200
שדהסוגחובהתיאור
itemsarray of objectכן
items[].numberintegerכן
items[].formIdinteger | nullכןnull when the form was deleted
items[].formTitlestring | nullכן
items[].userIdstringכן
items[].statusstringכןאחד מ: pending, interview, hold, accepted, denied, withdrawn
items[].votesobjectכן
items[].votes.upintegerכן
items[].votes.downintegerכן
items[].submittedAtstring | nullכןISO 8601 date-time
items[].decidedAtstring | nullכןISO 8601 date-time
items[].decidedBystring | nullכןnull = system / API
items[].reasonstring | nullכן
nextCursorstring | nullכן
תשובה · 200
{
  "items": [
    {
      "number": 7,
      "formId": 98765,
      "formTitle": "example",
      "userId": "876543210987654321",
      "status": "pending",
      "votes": {
        "up": 10,
        "down": 10
      },
      "submittedAt": "2026-10-07T12:00:00.000Z",
      "decidedAt": "2026-10-07T12:00:00.000Z",
      "decidedBy": "example",
      "reason": "Tournament prize"
    }
  ],
  "nextCursor": "98700"
}

דוגמאות

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/submissions?limit=25" \
  -H "Authorization: Bearer $BOTGG_API_KEY"
JavaScript (fetch)
// 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/applications/submissions?limit=25', {
  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);
Python (requests)
import os
import requests

res = requests.get(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/submissions",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
    },
    params={
        "limit": 25,
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

שגיאות

שגיאות
HTTPקודים
409FEATURE_DISABLED
503SERVICE_UNAVAILABLE

Get an application

GET/guilds/{guildId}/applications/submissions/{number}

הרשאה: applications:read

With the answers and the applicant snapshot taken at submit time (account age, join date, roles, level).

נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: מועמדויות

פרמטרים
שםמיקוםסוגחובהתיאור
guildIdנתיבstringכןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)
numberנתיבstringכן

תשובה

שדות התשובה · 200
שדהסוגחובהתיאור
numberintegerכן
formIdinteger | nullכןnull when the form was deleted
formTitlestring | nullכן
userIdstringכן
statusstringכןאחד מ: pending, interview, hold, accepted, denied, withdrawn
votesobjectכן
votes.upintegerכן
votes.downintegerכן
submittedAtstring | nullכןISO 8601 date-time
decidedAtstring | nullכןISO 8601 date-time
decidedBystring | nullכןnull = system / API
reasonstring | nullכן
answersarray of objectכן
answers[].idstringכן
answers[].typestringכן
answers[].labelstringכן
answers[].textstringכן
applicantobjectכן
applicant.accountCreatedAtstring | nullכןISO 8601 date-time
applicant.joinedAtstring | nullכןISO 8601 date-time
applicant.roleIdsarray of stringכן
applicant.levelinteger | nullכן
applyingbooleanכןA console/API decision is still being applied in Discord
failedActionsarray of objectכן
failedActions[].typestringכן
failedActions[].errorstring | nullכן
תשובה · 200
{
  "number": 7,
  "formId": 98765,
  "formTitle": "example",
  "userId": "876543210987654321",
  "status": "pending",
  "votes": {
    "up": 10,
    "down": 10
  },
  "submittedAt": "2026-10-07T12:00:00.000Z",
  "decidedAt": "2026-10-07T12:00:00.000Z",
  "decidedBy": "example",
  "reason": "Tournament prize",
  "answers": [
    {
      "id": "example",
      "type": "example",
      "label": "Example",
      "text": "Example answer"
    }
  ],
  "applicant": {
    "accountCreatedAt": "2026-10-07T12:00:00.000Z",
    "joinedAt": "2026-10-07T12:00:00.000Z",
    "roleIds": [
      "234567890123456789"
    ],
    "level": 5
  },
  "applying": true,
  "failedActions": [
    {
      "type": "example",
      "error": "example"
    }
  ]
}

דוגמאות

curl
curl -s "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/submissions/234567890123456789" \
  -H "Authorization: Bearer $BOTGG_API_KEY"
JavaScript (fetch)
// 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/applications/submissions/234567890123456789', {
  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);
Python (requests)
import os
import requests

res = requests.get(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/submissions/234567890123456789",
    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)

שגיאות

Accept or deny an application

POST/guilds/{guildId}/applications/submissions/{number}/decision

הרשאה: applications:writeIdempotency-Key

Same as Accept / Deny in the console: decided now (status, reason, reapply cooldown after a denial), then the bot gives / removes the form’s roles, DMs the applicant, announces and updates the review within a few seconds (applying). Written to the audit log.

נדרש שהפיצ׳ר הזה יהיה מופעל בשרת: מועמדויות

פרמטרים
שםמיקוםסוגחובהתיאור
guildIdנתיבstringכןהמזהה של השרת שלכם · מזהה דיסקורד (מחרוזת)
numberנתיבstringכן
Idempotency-Keyכותרתstringלאלא חובה. שלחו ערך ייחודי (UUID) והשתמשו בו שוב בניסיונות חוזרים — השינוי יקרה פעם אחת בלבד. איך זה עובד

גוף הבקשה

גוף הבקשה
שדהסוגחובהתיאור
decisionstringכןאחד מ: accepted, denied
reasonstring | nullלאSent to the applicant (DM) and shown in the review
עד 1,000 תווים

תשובה

שדות התשובה · 202
שדהסוגחובהתיאור
numberintegerכן
formIdinteger | nullכןnull when the form was deleted
formTitlestring | nullכן
userIdstringכן
statusstringכןאחד מ: pending, interview, hold, accepted, denied, withdrawn
votesobjectכן
votes.upintegerכן
votes.downintegerכן
submittedAtstring | nullכןISO 8601 date-time
decidedAtstring | nullכןISO 8601 date-time
decidedBystring | nullכןnull = system / API
reasonstring | nullכן
answersarray of objectכן
answers[].idstringכן
answers[].typestringכן
answers[].labelstringכן
answers[].textstringכן
applicantobjectכן
applicant.accountCreatedAtstring | nullכןISO 8601 date-time
applicant.joinedAtstring | nullכןISO 8601 date-time
applicant.roleIdsarray of stringכן
applicant.levelinteger | nullכן
applyingbooleanכןA console/API decision is still being applied in Discord
failedActionsarray of objectכן
failedActions[].typestringכן
failedActions[].errorstring | nullכן
תשובה · 202
{
  "number": 7,
  "formId": 98765,
  "formTitle": "example",
  "userId": "876543210987654321",
  "status": "pending",
  "votes": {
    "up": 10,
    "down": 10
  },
  "submittedAt": "2026-10-07T12:00:00.000Z",
  "decidedAt": "2026-10-07T12:00:00.000Z",
  "decidedBy": "example",
  "reason": "Tournament prize",
  "answers": [
    {
      "id": "example",
      "type": "example",
      "label": "Example",
      "text": "Example answer"
    }
  ],
  "applicant": {
    "accountCreatedAt": "2026-10-07T12:00:00.000Z",
    "joinedAt": "2026-10-07T12:00:00.000Z",
    "roleIds": [
      "234567890123456789"
    ],
    "level": 5
  },
  "applying": true,
  "failedActions": [
    {
      "type": "example",
      "error": "example"
    }
  ]
}

דוגמאות

curl
curl -s -X POST "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/submissions/234567890123456789/decision" \
  -H "Authorization: Bearer $BOTGG_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"decision":"accepted","reason":"Tournament prize"}'
JavaScript (fetch)
// 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/applications/submissions/234567890123456789/decision', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BOTGG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(), // reuse it when you retry this request
  },
  body: JSON.stringify({
    decision: 'accepted',
    reason: 'Tournament prize',
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.error}: ${data.message}`);
console.log(data);
Python (requests)
import os, uuid
import requests

res = requests.post(
    "https://console.botgg.app/api/v1/guilds/123456789012345678/applications/submissions/234567890123456789/decision",
    headers={
        "Authorization": f"Bearer {os.environ['BOTGG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),  # reuse it when you retry this request
    },
    json={
        "decision": "accepted",
        "reason": "Tournament prize",
    },
    timeout=10,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {data['error']}: {data['message']}")
print(data)

שגיאות

מוכנים לשדרג את השרת?

מוסיפים את BotGG בחינם ומפעילים יכולות בקונסולת הווב.