Skip to main content

Example 4. POST

JSight API 0.3OpenAPI 3.0.1 (Swagger)
JSIGHT 0.3

POST /cats // Create a new cat.
Request
{
"id" : 123,
"name": "Tom"
}

200
"OK" // {const: true}

404 any
500 empty

Please note that the POST request and the three response options are written in a clear and concise manner.

More about requests and responses: Quick Tutorial. Lesson 6. Requests and Responses.

Star us on GitHub — it motivates us a lot!

openapi: 3.0.3
info:
title: ""
version: ""
paths:
/cats:
post:
summary: "Create a new cat"
requestBody:
content:
application/json:
schema:
type: object
required: [id, name]
properties:
id:
type: integer
minimum: 0
example: 123
name:
type: string
example: "Tom"
responses:
200:
description: ""
content:
application/json:
schema:
type: string
enum: ["OK"]
404:
description: ""
content:
application/json:
schema: {}
500:
description: ""