4 ms·
What's the best way of handling failwhales that appear in the API? Sometimes they appear with the right HTTP response code, but at other times they don't - most
by mootothemax 16y ago
What's the best way of handling failwhales that appear in the API? Sometimes they appear with the right HTTP response code, but at other times they don't - most helpful. Right now, I'm checking responses for the name of the failwhale image - is this what you do as well?
- netaddict 16y agoThe Twitter API docs (http://dev.twitter.com http://dev.twitter.com) has HTTP error codes for each Twitter API. There is Twitter Search API, Twitter REST API and Twitter Streaming API. So though the meaning of the error code might differ slightly generally it is the same. For example, 200 is always successful request and 404 is always resource not found. Are you seriously checking for failwhale's image name in API response?
- abraham 16y agoFor successful API calls that return a status code other then 200 I would just ignore them. There are no API methods that will cause havoc by being called twice (other then maybe sending a duplicate DM.) For failed API calls that return a 200 status code validate the response. For example if you are getting a user then verify that there is a screen_name and id present. If they are present in the response you are fairly safe to assume the call actually succeeded.