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

Unlock the full course today

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

Building posts with request bodies

Building posts with request bodies - REST Tutorial

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

Start my 1-month free trial

Building posts with request bodies

or put operation with the new data placed Let's create a post operation within the product a product end point. Within that path we're simply going to add a new operation of type post. Inside the post operation we can add a description so that API consumers can understand when to use this operation. So we can say, "Add a product to the catalog," and that's what we will use this operation for. and that's what we will use this operation for. And the next thing we'll do is describe the request body for this operation. So we're going to describe the data that the API client must send in order to create a new product. It's very similar to some of the definition that we saw within the responses object. that we saw within the responses object. We have the content object once again and then we supply the media type of the data being provided, in this case we're using JSON, being provided, in this case we're using JSON, and then we're…

Contents