Chapter 2. Designing APIs with AsyncAPI

In this chapter, we’ll get hands-on with the work of designing an asynchronous API for the ordering system of a shoe store. We’ll introduce and use the AsyncAPI description language to define the specification of our API. By the end of the chapter, we’ll have designed a complete asynchronous API. Let’s get started by taking a closer look at the AsyncAPI format.

Why AsyncAPI?

APIs enable software to perform jobs and access data by providing an interface. Well-designed APIs make it easier for developers to write code that uses that interface. Good API design includes using words that developers understand and describing functions that fit the developer’s jobs to be done. But, along with these design concerns, designers need a way to clearly describe what their API does in a meaningful, easy-to-consume manner. That’s where API description languages help.

Description languages are standardized formats for describing the important parts of an API. For many years, the Open API Specification (OAS) has been the universal description language for HTTP and RESTful APIs. Thanks to OAS, an API designer can express their design choices for URIs, HTTP methods, and message schemas in a single, standardized file. That OAS API description can then be automatically imported and used in a rich ecosystem of tools for discovery, documentation, development, testing, and release.

But, OAS isn’t a great fit for the EVENTful style of APIs we described in the previous ...

Get What Are Asynchronous APIs? now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.