Service Publishing

Discuss the concept of service publishing in the context of microservices and demonstrate how to publish services using Azure API Management.

Now that we have an API, an easy-to-navigate specification for it, and a service discovery layer that manages the distribution of requests to healthy service instances, developers just need to know where to look for our service. This is where service publishing comes into play.

We can think of service publishing as a directory to search for or simply browse services that want to be discovered for use. White pages are a close analogy. Only imagine that this directory not only helps us look up services but manages security, offers advanced monitoring, and can even add a façade that allows API requests and responses to be translated on the fly. A façade could even call multiple APIs on the backend with a single composite API endpoint on the frontend. Many even support the mocking of APIs, so we can take our design-first approach, build an OpenAPI Specification, and then have one team implement a simple mock service while another implements the actual code base!

There are many tools and services out there that facilitate service publishing. We can even search the web for API indexes. If we’re willing to spend some dollars, we can get access to some interesting information sources out there via published APIs.

The NASA public APIs are nice to play around with, although they do not currently expose an OpenAPI specification. No doubt this is in use somewhere behind the scenes. The main point is that we have somewhere to go, for a given organization, area of interest, or community group, where we can easily look for API services to consume.

Azure API Management

Azure API Management (or Azure APIM, as it is more commonly abbreviated) provides a vast amount of functionality to support any organization’s API ecosystem. Specifically, we’ll focus on the use of API service publishing.

To demonstrate how we can easily publish services via APIM, we need to create an instance of the service in Azure.

Note: The Azure API Management service can be costly to leave provision for an extended period. At the time of writing, we can create a Dev SKU instance of APIM for about $0.07/hour. We should be able to spend less than $1 to complete this exercise for ourself.

Creating APIM instance

Let’s create an APIM instance and publish our API definition:

  1. We log in to the Azure portal and search for “API management services” in the search bar.

Get hands-on with 1200+ tech skills courses.