If you are trying to integrate with Exotel, you may want to debug your HTTP endpoints. Or, you may be trying out a new language or a framework and your HTTP requests may not be working and you have no idea why. The data and the end points are the same, but you can’t seem to get it to work.
In either case, RequestBin is your good friend and can help immensely in debugging. RequestBin provides a simple interface to see what you’re actually sending and what is received at the server’s end when you make a request. RequestBin gives you a URL that will collect requests made to it and let you inspect them in a human-friendly way. Use RequestBin to see what your HTTP client is sending or to inspect and debug webhook requests.
Here are a couple of instances when RequestBin really saved my life and helped me save hours (it really would’ve taken that long to debug these issues otherwise).
A customer using “angular js” posted a support request saying the Exotel API is responding with “From not specified” when the request is made to make a call. He wasn’t able to figure out why this was happening. He was using the URL we specified, forming the right JSON object (request data) and using basic auth to make the request.
The best way to debug this issue was to see how the request is reaching the endpoint because the library used for sending request would do some preprocessing that’s abstracted from the user. I generated a RequestBin URL and suggested that the customer replace Exotel’s URL with the requestb.in URL (something like http://requestb.in/1csoq3e1). Once he changed the URL to the requestbin URL and made the request, the RequestBin page showed how the request was received and the contents and headers in the request.
I was then able to pinpoint the reason for the failure. The “Content-type” was JSON instead of “application/x-www-form-urlencoded” and the data was not formed well. Now, that the I knew what the issue was, I was able to suggest a solution.
——
Another user was facing problems with the passthru applet not hitting their server. When I checked, I saw that we got a 403 from their server. They made the request from POSTMAN client(still not using POSTMAN? You should) on the Firefox browser for testing if the url is working and it was without a glitch. But when we tried from linux console using curl it was throwing an error.I quickly made a request to a request bin using curl and POSTMAN and checked the difference in how the request is made and added the headers to curl request to balance it with the request browser was making and finally figured out the issue.
From the browser, user agent was
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0
But from curl on Command line it was
User-Agent: curl/7.35.0
It turned out that the apache configuration that he had had a security module enabled that allowed requests from only user-agents like browsers.I explained the same to the user and the issue was resolved
Here is a 3 step guide to get started
—————
1. Go to http://requestb.in/ and click on “create a RequestBin” button
This creates a session for the user and a bin URL. Copy the url
2. Replace the HTTP endpoint you are testing with the bin url like following
curl -XGET http://requestb.in/147fgu51 -H “User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0”
3. Now refresh the page on requestb.in and see the request as received by the server
Now this can be used to debug http requests faster. Hack on