Define an HTTP PUT Endpoint for a Node.js API Server with Swagger

Will Button
InstructorWill Button

Share this video with your friends

Send Tweet
Published 6 years ago
Updated 4 months ago

In this lesson, you will learn how to define multiple parameters in the API specification to identify the ID of the Todo item being updated in the URL, as well as the contents for the updated Todo item in the body of the request.

Instructor: [0:01] The last thing I want to do on this same endpoint is have a Put operation. This is going to allow us to update a single Todo by its ID. The operation ID will be update Todo by ID. The parameters look familiar as the others in the path.

[0:21] We're going to have the ID number of the Todo being updated, but we're also going to have a second parameter that's the updateTodo because we need to know what to update in our Todo. This one is going to be found in the body.

[0:39] Our schema again will be the dollar sign ref. Then for responses, we'll have our 200 response. We'll also include a 400 response that we'll include in case there's any errors.