错误响应包含一个供程序使用的错误码,和一句可以展示给人看的话。
错误的结构
错误
{
"error": "bad_lang",
"message": "Choose the language readers should get, like en or pt-BR."
}
所有错误码
这些是 /v1 接口返回的所有错误码。密钥会最先检查,所以不带有效密钥的请求无论还有什么其他问题,都会得到 401。
| 代码 | 状态 | 接口 | 消息和含义 |
|---|---|---|---|
unauthorized | 401 | 全部 | “Send your API key as: Authorization: Bearer wg_…”(请以 Authorization: Bearer wg_… 的形式发送您的 API 密钥)。密钥缺失、拼写错误或已被撤销。 |
inactive | 403 | links、warm | “This account is suspended, so new links can’t be made…”(该账户已被暂停,所以无法生成新链接……)或“…so pages can’t be loaded ahead…”(……所以无法预加载页面……),并附上可联系的地址。账户已被暂停。每个新账户都从 Free 套餐开始,所以这种情况很少见。 |
not_in_plan | 403 | 全部 | “The API and MCP are part of Starter, Pro and Premium. Choose a plan in Dashboard → Billing.”(API 和 MCP 属于 Starter、Pro 和 Premium 套餐。请在控制台 → 账单中选择套餐。)账户使用的是 Free 套餐,例如付费套餐结束之后:在选择套餐之前,它的密钥不能使用。 |
not_in_plan | 403 | warm | “Loading pages ahead of time is part of Pro and Premium.”(预加载页面属于 Pro 和 Premium 套餐。) |
over_quota | 403 | warm | “This month’s translated pages are used up, so there’s nothing to load ahead for.”(本月的译文页面已用完,所以没有可预加载的内容。)链接在1日之前打开的是原文。 |
warm_limit | 429 | warm | “That’s as many pages as your plan loads ahead in a month.”(这已是您的套餐每月可预加载的页数。)等于套餐每月的页数:Pro 为1,000,Premium 为3,000。从1日重新开始。 |
bad_url | 400 | links、warm | “Enter the full address of the page, starting with https://”(请输入页面的完整地址,以 https:// 开头)(来自 warm:“Enter the full address, starting with https://”(请输入完整地址,以 https:// 开头))。url 字段缺失或不是完整地址,或者请求体无法读取:没有 JSON 或表单内容类型,或者 JSON 无效。 |
bad_url | 400 | links、warm | “That address can't be translated. Use a public web page.”(该地址无法翻译。请使用公开的网页。)这是翻译器从不加载的地址。 |
unsafe_url | 400 | links | “Google Safe Browsing lists this page as dangerous (phishing or malware), so Wallgone won't link to it.”(Google Safe Browsing 将此页面列为危险页面(网络钓鱼或恶意软件),所以 Wallgone 不会为它生成链接。)Google Web Risk 将该页面列为网络钓鱼、恶意软件或不受欢迎的软件。 |
bad_lang | 400 | links | “Choose the language readers should get, like en or pt-BR.”(请选择读者应看到的语言,例如 en 或 pt-BR。) |
bad_links | 400 | links/bulk | “Send 1 to 500 links: …”(发送1到500个链接:……)links 缺失、为空、不是列表,或超过500个。请分多次请求发送更多链接。 |
bad_lang_switch | 400 | links | “lang_switch is true, false, or left out for the account’s setting.”(lang_switch 为 true、false,或省略以沿用账户的设置。) |
bad_country | 400 | links、warm | “Use a two-letter country code like jp, or leave it out.”(请使用两个字母的国家代码,例如 jp,或者省略。) |
blocked | 403 | warm | “This publisher asked not to be translated, so its pages open as they are.”(该发布者要求不被翻译,所以它的页面按原样打开。) |
plan_changing | 409 | warm | “Your plan changed a moment ago. Try again in 30 seconds.”(您的套餐刚刚变更。请在30秒后重试。) |
not_found | 404 | 全部 | “No such endpoint.”(没有这个接口。)路径或方法有误,例如 GET /v1/warm。 |
server | 500 | 全部 | “Something went wrong on our side. Try again in a minute.”(我们这边出了问题。请1分钟后重试。) |
translator | 502 | warm | “Couldn't reach the translator. Try again in a minute.”(无法连接翻译器。请1分钟后重试。) |