top | item 14437745

Ask HN: Tools that can notify us when our REST API call fails

14 points| black_blood | 8 years ago

Hi,

I have just observed that my production REST API calls are failing (timeout or error status codes) even though the server itself is running. I am not sure since when. As I have very limited user base, no one reported the issue.

I am looking for tools that test our REST API calls continuously and report to us if those calls start failing. Also, are there any other solutions such that the above scenario does not happen again?

Edit: I will/can debug what the issue here is. I am looking for specific simple tools/products that can take my GET API request, call it every n minutes, and notify me if the api request fails.

11 comments

order

jamesmishra|8 years ago

Runscope (https://www.runscope.com/) is a service that does this. The founder, John Sheehan, was an early Twilio employee and he lives and breathes developer APIs.

fiiv|8 years ago

There are a lot of possibilities as to why it's failing. For debugging error codes, it is easy - you can attach something to your error handling code, or in some frameworks you can just install a module/gem/etc that sends your error data off to a service like NewRelic or Opbeat (there's tons of these providers). Using these kinds of things you can understand not just the stack traces of errors but sometimes also the data the user submitted. You can also set up your own infrastructure that does the same, of course.

For timeouts, it may be tougher to do. If you use some kind of reverse proxy to spread the load to instances of your API, then this might be a nice place to start investigating your problems, and there is where you're going to want some tooling. If you're using Node.js, it could be possible the code for a specific endpoint does not send a response (maybe only under certain circumstances) - so you will need to debug that particular aspect of it and ensure that a response is sent, otherwise timeouts will happen.

As for actually sending test requests to your API, the difficultly with this method is that if, for example, you're posting a new user and your tool posts once every 5 mins, then you will have 12 garbage users after an hour. Not to mention that you will need to write a test for each error possibility as well, since it could be that a validation error is causing the timeout. So for this it probably makes sense to write a test suite, and include a test for each of the possible scenarios, or paths through your code.

black_blood|8 years ago

I am using Node.js express. I am not worried about what the actual error is. I will figure out if the tool just tells me that the REST API call is failing.

Regarding POSTing a new user every 5 mins, I will not test such an API call. I will test a simple GET call which does not need any authentication.

So, I am looking for a simple tool that takes my GET API request, calls it every n minutes, and notifies me if the api request fails.

cdnsteve|8 years ago

For something simple you could just catch the error and write to your logs. If you're using something like Papertrail you can setup filters to watch for and alert you of specific events like API failure. It can notify you via email, Slack or other things. Then you can simply login to papertrail and review the logs, hopefully with messaging that includes why it failed so you can investigate.

dmlittle|8 years ago

You can use Pingdom[1] to make regular requests over a period of time and have it alert you whenever it fails. I would also suggest an error reporting tool such as Sentry[2] to keep track of common errors and why a request might have failed.

[1] https://www.pingdom.com/

[2] https://sentry.io/

creichert|8 years ago

Assertible (https://assertible.com) can do this. Designed to be a simple API testing solution with flexible automation and monitoring. Disclaimer - I am a founder.

black_blood|8 years ago

I went ahead and created a free account in assertible. This is definitely doing what I want (test a simple GET rest api call). I will check further (if it is notifying me when a call fails).

@Others: One minor point to note here is that the free account allows only one hour Scheduled Monitoring, not more frequently.

jlengrand|8 years ago

Shameless plug, for something simple and visual we built Servsup a while ago.

http://servsup.co/

It's fully open source

whatnotests|8 years ago

StatusCake is nice. Also Zabbix.

Avalaxy|8 years ago

Maybe something like pingdom?