Runscope API Monitoring    Learn More →

Runscope for API Developers

By John Sheehan on .


In honor of Dreamforce '13 taking place this week in San Francisco, here's a guide for developers on using Runscope to help you solve API problems faster.

Recently Jeff Douglas from Appirio put together a great post and video on debugging your REST API calls with Runscope. Jeff covers everything you need to get started capturing and viewing your calls. The video is worth a watch:

I wanted to dive a little deeper into the debugging topics Jeff covered, as well as point out a few other tools that will help you build your REST API integrations. If you haven’t yet, sign up for your free Runscope account to get started.

Debugging API Calls

The first step to debugging any programming problem is to start looking at data “in flight”. With your code this is typically done via print statements or a debugger if you’re in an IDE. We’ve taken that same principle and applied it to APIs. By using a Runscope URL you can watch all of your API calls as they happen. Once you can see your traffic, fixing problems becomes much, much easier.

Runscope URLs can be used in your code with near-zero changes. Once you’ve created a Runscope URL based on your instance URL (obtained via OAuth), replace the hostname in your code. Here’s an example based on the Getting Started guide:

String accessToken = (String) request.getSession().getAttribute(ACCESS_TOKEN);
String instanceUrl = (String) request.getSession().getAttribute(INSTANCE_URL);

// example Runscope URL
instanceUrl = "";

writer.write("We have an access token: " + accessToken + "\n" + "Using instance " + instanceUrl + "\n\n");

showAccounts(instanceUrl, accessToken, writer);

That one line change is all it takes to start capturing your API calls. The rest of your code remains unchanged. Once the problem is resolved, remove that line and calls will be made directly to the REST API again. All of your other code will continue to function normally.


API Testing with Runscope Radar

Runscope Radar allows you to create tests to verify that an API is returning the data your app expects to function. Capture real requests from your apps, then run the tests on every build, deploy or even commit. You can even execute multiple requests and pass state between them to test entire workflows.

Generating OAuth Tokens for Testing

OAuth is a powerful authentication tool, but when you're just getting started building a new application having to set up a server to create access tokens can be a hassle. We've created an OAuth 2 Token Generator tool that allows you to skip the server requirement, kick off the authorization flow and create an access token for you to use during development.

Collaborate with your Team

When working with APIs it can be useful to get a second pair of eyes on a request or response to help narrow down issues. With Runscope, you can easily share any given request with anyone via a Share Link, or privately with your team if you're on a Starter or Team plan. Shared requests support comments so you can avoid prolonged email chains discussing an issue. You can also organize common requests into collections and annotate them with notes to keep track of the most important requests.

Learn More at Dreamforce 2013

I've only scratched the surface on API debugging in this post. I'll be giving a session at Dreamforce 2013 called "Zen and the Art of API Maintenance" Tuesday at 4:45 in the Developer Theater where we'll go in-depth on API debugging, testing and maintenance tools and strategies to help you build more resilient API-driven apps. Don't miss it!

Categories: events, api ecosystem, debugging, testing

Everything is going to be 200 OK®