blog

Graphic of the PAW UI

Exploring & Debugging APIs with Paw

by

The team at Lucky Marmot bills Paw as “The Ultimate REST client for Mac” and in my experience with the app so far it lives up to the claim.
The app allows you to make HTTP requests, inspect the responses, and even generate code for the requests for a number of languages and tools. If you’re developing your own API or learning how to interact with a third party one, Paw quickly becomes an invaluable and indispensable debugging and development tool.
Making Requests
Paw is focused on making HTTP requests that you can configure, edit, duplicate, and reuse. It allows you to set request headers, options, URL params, and more so that you can make everything from a simple GET request to performing a multi-part file upload. It includes formatters to make sure you’re request is easy to create and validation warnings to let you know when you’ve likely got something wrong. It often offers a way to quickly fix any issues too. Paw allows you to name, group, and sort requests in a document that can be shared with the rest of your team.
Where it really shines is when you start reusing requests with Cookie Jars, Dynamic Values, and Environments. Cookie Jars are essentially swappable cookie stores that allow you to make requests while simulating different user sessions or other conditions stored as cookies. Dynamic Values allow you to access data from previous responses, perform functions on that data, or generate new data to include in your requests. Paw includes a number of common Dynamic Values, and allows you to install (or create your own) extensions to add new ones. Finally, Environments allow you to define collections of variables to use within requests. For example, if you’re working with an API on a staging and production server you can define variables for the host and port in a Staging and Production environments, and quickly switch between them to make and compare requests to the different servers without modifying your request.
Inspecting Responses
Once you’ve made a request you’ll be able to see the response value, headers, and status code, what you’d expect. You’ll likely spend most of your time inspecting the response body and Paw does a great job of formatting it as text, formatted JSON, raw JSON text, XML, or can display any HTML in a web view. Chances are you’re dealing with JSON and Paw formats the data as a nice outline, letting you expand or collapse arrays and dictionaries as necessary.
Code Generation & Extensions
Once you’re happy with the request  you’ve configured, you can use a Code Generator to generate code for many popular languages and tools, or if one isn’t available that you want can develop a custom one as an Extension. This isn’t a feature I’ve used much, but could definitely see it being useful.
Extensions are one of the coolest features of Paw, and come in three flavors: Code Generators, Dynamic Values, and Importers. They’re built using JavaScript or CoffeeScript. I haven’t gotten as far as developing my own extension yet but from looking at the source of a few in Lucky Marmot’s collection on GitHub it doesn’t look that difficult. While checking out the Importers I found about Swagger, API Blueprint, Apiary, and Mashape too and plan to spend some time checking them out. The API documentation, testing, and management tools available here look awesome and integrate with Paw pretty easily too.
What’s Missing?
I’ve been using Paw as a companion to Charles while developing some iOS apps and it would be great if Paw had a proxy server built in so that you could record HTTP traffic, then edit and replay the requests. I’m not sure if a proxy server is on the roadmap for the team at Lucky Marmot or not, so I’ll look into building an Importer to import one of the formats that Charles can export to save myself some time in future projects.
Getting a Copy
Paw is available on the Mac App Store and available directly from Lucky Marmot for $29.99. They’ve got a nice explanation of the differences between the two versions as part of their documentation. I got my copy directly to have access to earlier updates and to give the developers their full cut of the $30.

+ more

Accurate Timing

Accurate Timing

In many tasks we need to do something at given intervals of time. The most obvious ways may not give you the best results. Time? Meh. The most basic tasks that don't have what you might call CPU-scale time requirements can be handled with the usual language and...

read more