postman

In case you missed the announcement last month, our SparkPost API documentation now comes with a “Run in Postman” button:

Untitled

What Does That Mean?

Cool! We’ve got a nifty new button. But what does that mean? And how do I know whether or not I’ll need (or want) it?
Here are the basics:

  • Are you (or one of your other developers) digging into the SparkPost API yourself, in addition to using the automated systems built around it?
  • Are you a little uncomfortable with the details of HTTP requests?
  • Do you have a hard time remembering what particular cURL command to use?

Postman to the rescue! It parses your API request and response and displays them in more manageable formats. It also simplifies the creation of API requests, which means you’re off the hook for finding the arcane syntax that will pull the precise information you’re in search of.

As Dave mentions in his blog post:

Postman gives less-technical users a way to make arbitrary HTTP requests using a point and click user interface. Collections make it easy to organize your requests and, to a point, share them. Environments make it easy to switch authentication keys and make other things configurable without editing each request.

Is your interest piqued? Good! Then without further ado, let’s dive in…

Getting Started

So what do you need to do to start using this?

Firstly, when you click this button, you’ll be directed to open this collection with your installed Postman app.

You will then see the “SparkPost API” collection show up in the left-side pane, and you can expand the various folders in the collection.

Untitled1

There are currently 76 different request types in the collection; we’ll be adding more as the API becomes even richer.

You can try running these right away – for example Message Events / Get Samples.  You’ll see results come right back in the Response window.

postman

This particular request works straight away, because just getting samples back doesn’t require authorization.

Setting up Authorization

If you try most of the other requests – such as “List All Sending Domains” – you’ll get a message saying

because each account’s data is private. You’ll need an API key set up to access this information.

postman

Here’s where a neat feature of Postman comes in. The Environments collection is set up to look for a Postman variable called {{API_KEY}}.  You can see this by viewing the request headers.

postman

If you don’t have an API key yet, you’ll want to create one.

Once you have your API key in hand, go to “Manage Environments.”

postman

Choose Add, and type a name, e.g. “My SparkPost setup.”  Then add your key and value.

Key should be just the words API_KEY  (without the curly braces this time), and the value is your specific hex string.

postman

Hit Add.  Choose “My SparkPost Setup” from your drop-down list of environments in Postman.

postman

Re-run your API request, and your authorization will be used for each of the collection’s requests without any further editing.

Here’s what I get back from “List all Sending Domains” — I can see my domain is set up and ready to go.

Untitled8

Now you’re set to explore the other requests in this collection.  Happy exploring!

postman and sparkpost

Run in Postman

Run SparkPost in Postman

SparkPost is an API-first service, targeting developers. What this means in practice is that we build our APIs (you guessed it) first, and then build our UI using those same API calls. We also have quite a few human users of our APIs, in addition to the automated systems we’ve built around them. Some of these users aren’t comfortable enough on the command line, or with the details of HTTP, to use cURL to build their API requests. This is where Postman comes in, turning the API request and response into something much more human-readable.

There’s a UI for That

Postman gives less-technical users a way to make arbitrary HTTP requests using a point and click user interface. Collections make it easy to organize your requests and, to a point, share them. Environments make it easy to switch authentication keys and make other things configurable without editing each request.

The new Run in Postman button makes it much easier to share collections. Since we already use Postman internally, and for demos, it was a no brainer for us to get the button set up, using examples from our API documentation.

Roll Your Own

There are lots of things you can do with the SparkPost API, and now, more easily, with Postman. For example, you could send quick, one-off test messages, or experiment with some of our more complex templating features.

When it’s time to do some data analysis, our API gives you lots of options about what kinds of metrics you’d like to see, what period of time you’d like to see data for, and how to group the data that’s returned. The examples that we’ve provided are organized by endpoint, so they’re really showing you what types of questions can be answered.

Customizing these queries so they answer the sorts of questions you have about what you’re sending is where things start to get interesting. Show us how you’re using our collection and get your questions answered on SlackTwitter or good ole’ email.

 

Blog-Banner-WeHeartDev_600x150-030416