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.
Solution: Create company blog posts - REST Tutorial
From the course: Building APIs with Swagger and the OpenAPI Specification
Solution: Create company blog posts
(upbeat music) - [Instructor] In this video, I'll share my solution for this challenge. To get started, I'm going to add a component section to the bottom of the file. Within this component section, I'm going to create a reusable schema object that represents the article resource. This component will provide us with some reusability throughout the API definition, and we can avoid repeating the article schema object throughout the file. To define the properties on the article schema object, we can go ahead and copy the properties from the object on our get operation. So I'm just going to go ahead and copy these fields and place them within the article schema object at the bottom of the file. Once they're in place, I can go ahead and click on Edit and then convert to YAML and the file will automatically format. Now we can just go ahead and remove those properties from the API definition underneath the get operation.…
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
-
-
-
-
(Locked)
Defining APIs3m 23s
-
(Locked)
Reading the specification5m 40s
-
(Locked)
Paths with query parameters3m 53s
-
(Locked)
Template parameters in paths4m 45s
-
(Locked)
Building posts with request bodies3m 34s
-
(Locked)
Achieving reusability with components7m 1s
-
(Locked)
Response objects3m 34s
-
(Locked)
Reusing parameters2m 41s
-
(Locked)
Content negotiation2m 21s
-
(Locked)
Swagger UI3m 22s
-
(Locked)
Challenge: Create company blog posts1m 9s
-
(Locked)
Solution: Create company blog posts3m 37s
-
(Locked)
-
-
-