Creating an HTTP Web Service

The simplest API is the one that we query, and it hands us back data. It used to be common to serve up either XML or some binary data based on the technology stack.

In today’s world of e-commerce and mashups, the popular choice is JSON (JavaScript Object Notation). Creating a Spring WebFlux endpoint that gives us JSON instead of HTML couldn’t be easier.

So far, we’ve developed a shopping Cart containing one or more Item objects. We then persisted these objects into MongoDB and displayed them to the user by using templates.

Let’s build our interfaces for external systems, otherwise known as APIs.

In this chapter, we’ll:

Get hands-on with 1200+ tech skills courses.