שגיאות
קריאות בסגנון TMDB מחזירות שגיאות בגוף של TMDB: success עם הערך false, status_code מספרי ו-status_message. קריאות בסגנון OMDb מחזירות Response עם הערך False ומחרוזת Error. amodb משתמש ב-8 קודים של TMDB, מ-7 למפתח לא תקין ועד 25 למגבלת הקצב ו-36 למסלול שפג. כדאי לנסות שוב רק 429, 500 ו-504.
גוף שגיאה בסגנון TMDB
כל שגיאה מ-https:/ היא בעלת אותו מבנה JSON כמו ב-TMDB:
{
"success": false,
"status_code": 34,
"status_message": "The resource you requested could not be found."
}קודי שגיאה
| HTTP | status_code | status_message | מה לעשות |
|---|---|---|---|
| 401 | 7 | Invalid API key: You must be granted a valid key. | בדקו את המפתח ואת האופן שבו אתם שולחים אותו. |
| 401 | 10 | Suspended API key: Access to your account has been suspended, contact amodb. | כתבו אל support@amodb.dev. |
| 402 | 36 | Your plan has expired. Renew at https://amodb.dev/pricing | שלמו עבור תקופה חדשה. |
| 404 | 34 | The resource you requested could not be found. | בדקו את המזהה או את הנתיב. |
| 405 | 37 | This method is not offered by amodb. | השתמשו בנקודת קצה לקריאה. |
| 429 | 25 | Your request count (N) is over the allowed limit of (L). | המתינו Retry-After שניות. |
| 500 | 11 | Internal error: Something went wrong, contact amodb. | נסו שוב אחרי כמה שניות. |
| 504 | 24 | Your request to the backend server timed out. Try again. | נסו שוב אחרי כמה שניות. |
גוף שגיאה בסגנון OMDb
נקודת הקצה התואמת ל-OMDb שומרת על המבנה ועל הניסוח של OMDb:
קריאת OMDb עם r=xml מחזירה HTTP 400. השתמשו ב-r=json או השמיטו את r.
{
"Response": "False",
"Error": "Movie not found!"
}const res = await fetch("https://api.amodb.dev/3/movie/550", {
headers: { Authorization: `Bearer ${process.env.AMODB_KEY}` },
});
if (!res.ok) {
const err = await res.json();
if (res.status === 429) {
// wait Retry-After seconds, then retry
}
throw new Error(`amodb ${res.status} code ${err.status_code}: ${err.status_message}`);
}res = requests.get(url, headers=headers, timeout=10)
if not res.ok:
err = res.json()
raise RuntimeError(f"amodb {res.status_code} code {err['status_code']}: {err['status_message']}")גיבויים שאינם שגיאות
- תגית
languageלא מוכרת לא נכשלת. amodb מגיש עבורה אנגלית. - שדה בלי נתונים הוא
nullאו מערך ריק, כמו ב-TMDB.