OAS:OpenAPI Editor/Request Body
Request bodies are typically used with “create” and “update” operations (POST, PUT, PATCH). For example, when creating a resource using POST or PUT, the request body usually contains the representation of the resource to be created. OpenAPI 3.0 provides the requestBody keyword to describe request bodies.
The Remain API Studio allows editing both global request bodies residing in the components section and those local to an operation.
Add A Global Request Body
To add a global request body, select the tab Global Request Bodies then click the addition button (+) in the local (top-right) toolbar. A new request body with a generated name is added at the bottom of the tab. Update the name and fill in the required fields. Add a content type and define a schema to use within that content as explained in the following sections.
Add An Operation Request Body
Select the operation you want to add the request body to. Then select the operation request body tab.
From the top-right local toolbar either click the addition button (+) to add a new request body or the drop-down button to get the ability to refer to an existing request body from the Global Request Bodies tab.
Add Request Body Content Type
To add a content type, Hover over the request body then click the appearing link Add content type.
Delete Request Body Content Type
To delete a content type hover over the content type UI then select the appearing link: Delete content
Add Schema to Request Body Content Type
You can add a schema to the content type by clicking the red link at the bottom of the content type reading "Add schema. Or clicking Change schema from the local toolbar.
Then either select an existing schema:
Or create a new schema on the fly and use it in this content type. You create an inline schema by letting the name field blank.
If you give the schema being created a name, it'll be also automatically added to the global components/schemas. It's then not an inline schema but referred to, by the content type.
Update Request Body Content Schema
To update the schema within the content type, hover over the content type UI then select the appearing link: Change schema.
Delete Request Body
Hover with the mouse over the request body you want to delete then click the link Delete request body.
Update Request Body
You can edit the request body by editing its input fields. Hover over the request body to get the local links to use to:
- Add a content type
- Change the content type schema
- Delete a content type from the request body