This week, API management Platform and marketplace Mashape unveiled Mockbin, a service that helps developers log, debug and simulate API calls made over HTTP.
Mockbin, which joins Web-based solutions like Apiary and desktop software such as Anypoint Studio, was developed by Mashape for internal testing. But the company, which maintains the open source Unirest HTTP Library and counts more than 10,000 APIs in its marketplace, decided that it wanted to open source Mockbin under an MIT license so that others could use it.
"Bins" are the core component of Mockbin. Each bin represents an API Endpoint that returns a predefined response. Developers can create bins using Mockbin's Web interface or, naturally, via the Mockbin API. Bins are defined using the HTTP Archive, or HAR, specification, and access logs also use the HAR format. Bins support all HTTP Methods, as well as custom headers, query strings and paths.
To make life easier for developers, Mockbin includes a number of utility endpoints that enable developers retrieve information about client IP addresses, user agents and cookies. JSON is the default format for responses, but Mockbin also supports XML, YAML and HTML.
For developers who don't want to use Mockbin in the cloud via mockbin.com, the open source project can be installed via npm or Docker and run as a standalone Web server. It can also be run as middleware for the Express Node.js Framework or deployed to Heroku with a single click.
Mocking Critical to the Development of API-Based Software
With more and more companies building and integrating APIs, the number of API-specific development tools has exploded, and solutions for mocking Web services are one area where developers have an increasing number of options. And for good reason. It's virtually impossible for many companies to build quality software if they don't have the ability to efficiently log and debug HTTP requests and to simulate API responses.
This is especially true because lots of companies are choosing to rely on third-party APIs to provide critical functionality. As venture capitalists Rich Wong and Vas Natarajan have noted, "today’s fastest-growing startups aren’t just launching great products, they’re launching “composites” — stitching together off-the-shelf APIs with proprietary code, and wrapping it all in a unique brand and design. For anyone moving at startup speed and building at Web scale, APIs aren’t just a Band-Aid to the future — they’re a necessary part of the foundation."
Given the importance of mocking, the emergence of new solutions like Mockbin and the growing sophistication of existing tools, developers would be wise to keep their eyes on this space.