Building Web APIs in Go

Understand what a web API is and how to write one in Go.

A web API is a service that provides access to some resources that can be consumed over the internet. Usually, the consumer is a client application, like a JavaScript application that lives within the browser, while the producer is an application that serves resources in a controlled way. This is why we talk about application-to-application communication. The de facto output of a web API is in JSON, though some APIs still reply with XML or other kinds of data. In addition, they don’t respond with HTML tags as they don’t provide any visual content to the caller. That’s why web APIs are meant to be contacted by applications that parse the data retrieved to produce visual content for the final user.

Web API

Now, let’s visualize the different actors of web communications:

Get hands-on with 1400+ tech skills courses.