From the course: Building APIs with Swagger and the OpenAPI Specification

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

Building a simple API

Building a simple API

- [Instructor] In this lesson, we'll build The API will respond to the request by returning Our API definition is going to be very minimal We can discover what fields or objects by visiting the OpenAPI specification. Here we are at the OAS 3.0 specification and if we navigate to the schema section it will list the different sections The OpenAPI field, the info field and the paths field. and that provides clues to Swagger Editor and we see the info field. the API itself, such as the title of the API. and we'll say it's version one. To do that, we first specify a path object. In this case, we're going to be exposing the product endpoint. Within that product endpoint, we're going to expose the get operation, which corresponds to the HTTP method that will be used to invoke this operation. to invoke this operation. You'll notice that we're using YAML. You'll notice that we're using YAML. So, it's important to indent two spaces when we have different fields on an…

Contents