Google Calendar API:“后端错误";代码503 [英] Google Calendar API : "Backend Error" code 503
问题描述
当我使用Google日历API创建新的日历时,我随机收到后端错误".你知道为什么吗?您是否经历过相同的行为?
When I use the Google calendar API to create a new Calendar, I randomly get "Backend Error". Do you have any idea why ? Have you experienced the same behavior ?
第一个请求:
POST https://www.googleapis.com/calendar/v3/calendars 授权: 承载ya29.UQEd-xxx 内容类型:application/json; charset = utf-8
POST https://www.googleapis.com/calendar/v3/calendars Authorization: Bearer ya29.UQEd-xxx Content-Type: application/json; charset=utf-8
{摘要":我的新日历名称"}
{"summary":"My new calendar name"}
Google回答(大约20秒后):
Google answer (around 20 seconds later):
{错误":{错误":[{域":全局",原因": "backendError","message":后端错误"}]代码":503,"message": 后端错误"}}
{ "error": { "errors": [ { "domain": "global", "reason": "backendError", "message": "Backend Error" } ] "code": 503, "message": "Backend Error" } }
未创建日历
另一个请求:
POST https://www.googleapis.com/calendar/v3/calendars 授权: 承载ya29.UQEd-yyy 内容类型:application/json; charset = utf-8
POST https://www.googleapis.com/calendar/v3/calendars Authorization: Bearer ya29.UQEd-yyy Content-Type: application/json; charset=utf-8
{摘要":我的新日历名称"}
{"summary":"My new calendar name"}
Google回答(约5秒后):200 日历已创建
Google answer (around 5 seconds later) : 200 The calendar is created
推荐答案
503服务不可用
该服务器当前不可用(因为它已超载或已关闭以进行维护).通常,这是一个临时状态.
503 Service Unavailable
The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.
503是有时会发生的标准HTTP错误. Google ops可能在某处有一个图形,显示了错误的发生频率,并且根据其优先级可能正在努力解决该错误.您应该抓住错误,并给人类提供重试或实施指数补偿的机会.
503 is a standard HTTP error that happens sometimes. Google ops probably has a graph somewhere showing the frequency of the errors and depending on their priorities may be working to fix it. You should catch the error and either give a human the chance to retry or implement exponential backoff.
Google Apps日历资源API限制和配额
对于所有基于时间的错误(每个线程最多N个事物,每个线程N秒),尤其是503状态代码错误,我们建议您的代码捕获异常,并使用
Google Apps Calendar Resource API Limits and Quotas
For all errors that are time based (maximum of N things for N seconds per thread), especially the 503 status code errors, we recommend your code catch the exception and, using an exponential backoff algorithm, wait for a small delay before retrying the failed call.
这篇关于Google Calendar API:“后端错误";代码503的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!