Fighting bird分享


[转载][备忘] Twitter API 1.1 Error Codes & Responses

已有 4936 次阅读 2013-7-3 00:51 |个人分类:未分类|系统分类:科研笔记|关键词:Twitter,Error| error, Twitter |文章来源:转载

HTTP Status Codes

The Twitter API attempts to return appropriate HTTP status codes for every request. It is possible to suppress response codes for the REST API.

304Not ModifiedThere was no new data to return.
400Bad RequestThe request was invalid. An accompanying error message will explain why. This is the status code will be returned during version 1.0 rate limiting. In API v1.1, a request without authentication is considered invalid and you will get this response.
401UnauthorizedAuthentication credentials were missing or incorrect.
403ForbiddenThe request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits.
404Not FoundThe URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method.
406Not AcceptableReturned by the Search API when an invalid format is specified in the request.
410GoneThis resource is gone. Used to indicate that an API endpoint has been turned off. For example: "The Twitter REST API v1 will soon stop functioning. Please migrate to API v1.1."
420Enhance Your CalmReturned by the version 1 Search and Trends APIs when you are being rate limited.
422Unprocessable EntityReturned when an image uploaded to POST account/update_profile_banner is unable to be processed.
429Too Many RequestsReturned in API v1.1 when a request cannot be served due to the application's rate limit having been exhausted for the resource. See Rate Limiting in API v1.1.
500Internal Server ErrorSomething is broken. Please post to the group so the Twitter team can investigate.
502Bad GatewayTwitter is down or being upgraded.
503Service UnavailableThe Twitter servers are up, but overloaded with requests. Try again later.
504Gateway timeoutThe Twitter servers are up, but the request couldn't be serviced due to some failure within our stack. Try again later.
Error Messages

When the Twitter API returns error messages, it does so in your requested format. For example, an error from a JSON method might look like this:

  1. {"errors":[{"message":"Sorry, that page does not exist","code":34}]}

The corresponding XML response would be:

  1. <?xmlversion="1.0"encoding="UTF-8"?>
  2. <errors>
  3. <errorcode="34">Sorry, that page does not exist</error>
  4. </errors>
Error Codes

In addition to descriptive error text, error messages contain machine-parseable codes. While the text for an error message may change, the codes will stay the same. The following table describes the codes which may appear when working with the API:

"response":{"errors":[{"message":"Your account is suspended and is not permitted to access this feature","code":64}]}}
32Could not authenticate youYour call could not be completed as dialed.
34Sorry, that page does not existCorresponds with an HTTP 404 - the specified resource was not found.
68The Twitter REST API v1 is no longer active. Please migrate to API v1.1. to a HTTP request to a retired v1-era URL.
88Rate limit exceededThe request limit for this resource has been reached for the current rate limit window.
89Invalid or expired tokenThe access token used in the request is incorrect or has expired. Used in API v1.1
64Your account is suspended and is not permitted to access this featureCorresponds with an HTTP 403 - the access token being used belongs to a suspended user and they can't complete the action you're trying to take
130Over capacityCorresponds with an HTTP 503 - Twitter is temporarily over capacity.
131Internal errorCorresponds with an HTTP 500 - An unknown internal error occurred.
135Could not authenticate youCorresponds with a HTTP 401 - it means that your oauth_timestamp is either ahead or behind our acceptable range
187Status is a duplicateThe status text has been Tweeted already by the authenticated account.
215Bad authentication dataTypically sent with 1.1 responses with HTTP code 400. The method requires authentication but it was not presented or was wholly invalid.
231User must verify loginReturned as a challenge in xAuth when the user has login verification enabled on their account and needs to be directed to to generate a temporary password.

If you see an error response which is not listed in the above table, then fall back to the HTTP status code in order to determine the best way to address the error.

上一篇:GibbsLDA++ 使用记录


该博文允许注册用户评论 请点击登录 评论 (0 个评论)


Archiver|手机版|科学网 ( 京ICP备14006957 )

GMT+8, 2019-12-16 03:19

Powered by

Copyright © 2007- 中国科学报社