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 - REST Tutorial
From the course: Building APIs with Swagger and the OpenAPI Specification
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Defining APIs3m 23s
-
Reading the specification5m 40s
-
Paths with query parameters3m 53s
-
Template parameters in paths4m 45s
-
Building posts with request bodies3m 34s
-
Achieving reusability with components7m 1s
-
Response objects3m 34s
-
Reusing parameters2m 41s
-
Content negotiation2m 21s
-
Swagger UI3m 22s
-
Challenge: Create company blog posts1m 9s
-
Solution: Create company blog posts3m 37s
-
-
-
-