How to Automatically Generate Clients for your REST API

Create client code in seconds for all popular languages, and save hours of repetitive manual labor.

Martin Cerruti
5 min readMar 4, 2020

--

Photo by Jon Cartagena on Unsplash

Chances are, if you’re developing RESTful APIs, you’ve heard of the OpenAPI specification (formerly known as Swagger) before. The OpenAPI Specification defines a standard interface to describe an API, regardless of the language it was written in. This specification can then be used to automatically create documentation based on conventions, or to automatically generate clients for your services.

Modern application landscapes often comprise of many independent services. Each of these services have one or more responsibilities, and have an interface to expose functionality to the outside world. In the case of RESTful services, this functionality is exposed over HTTP. Writing client code to interface with these services is often a very repetitive, slightly tedious task.

Fortunately, with the power of Microsoft’s AutoRest code generator, we can automatically generate client code for almost every popular language or framework out there.

In this guide, you’ll learn how to set up AutoRest to leverage the OpenAPI specification, and to generate a client for you. We’ll be using an ASP.NET Core Web API in the example…

--

--

Martin Cerruti

Software Architect, Technology Writer, but most of all a programmer.