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

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Paths with query parameters

Paths with query parameters - REST Tutorial

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

Start my 1-month free trial

Paths with query parameters

- In this lesson, we'll learn how to describe query parameters within an API definition. In the first demonstration, we build a simple end point that listed all the products available in the H Plus Sports catalog. It did not require API clients to provide additional data, which isn't the case for most API operations. Let's enhance that operation to accept two additional query parameters, page size and page number, that introduce a paging capability into the API. We'll introduce the new parameters using Swagger Editor. When we describe parameters for an API definition, we place them underneath the operation. So I'm going to create a new line below get, and here I can rely upon the auto-completion to specify the parameters object. Now inside of the parameters object, we can provide an array of parameters. The way we do that is by specifying a dash nested two spaces within the parameters object, then we use the in property to define the type of parameter. You'll see that we have several…

Contents