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

Unlock the full course today

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

Template parameters in paths

Template parameters in paths - REST Tutorial

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

Start my 1-month free trial

Template parameters in paths

REST APIs often require template parameters in the path of an endpoint. This helps us identify a specific resource instance in most cases. that captures a product ID within its path. That product ID can then be used To get started, we're going to create a new path within our Paths object. all we need to do is add the operation they're going to be required, so we set Require to True, and then we define the type of data using the schema and our datatype. And then as always, we can provide some sort of example. And then anytime we have an operation, And then anytime we have an operation, we know that the Responses object is required, we know that the Responses object is required, and since we've already defined a 200 response, and since we've already defined a 200 response, we're going to borrow from our other operation, and we'll just come up and provide that response. Now in this case, we're not going to be returning an array, so we'll have to do some modification…

Contents