DrupalCon Nashville 2018: Building Confidence in APIs with Postman

Reliable API calls are critical to any decoupled application. A simple configuration change to an entity or updating Drupal core can alter an API response and lead to application-breaking changes on the front-end. An API test suite can watch out for these API breaking changes by running a slew of tests against your endpoint.   

When you need to create an API test suite, Postman delivers. (Sorry. I had to.)

On its surface, Postman is a simple GUI for sending HTTP requests and viewing responses. But underneath, Postman is built upon an extensive set of power tools that are incredibly easy to use. You can organize your requests into collections and folders, share common values across requests with environment variables, script tests with the built-in node.js based runtime, and automate it all with Postman’s very own CLI – Newman.

In this session we’ll build up a test suite for Contenta, the API-first distribution of Drupal.

We’ll cover:

Making simple API requests

Making authenticated requests with varying authentication strategies

Using environment variables

Importing request collections directly from your Drupal site

Writing tests using JavaScript

Automating it all with Newman

Attendees will come away with a clearer understanding of how to make requests against Drupal’s JSON API module and working knowledge of how to leverage Postman when developing decoupled applications.

Drupal is a registered trademark of Dries Buytaert.