forked from WEB-IMB-WS2526/lab-development-imb
129 lines
2.5 KiB
JSON
129 lines
2.5 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "Hobbies API",
|
|
"version": "1.0.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "http://localhost:8080"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/insert": {
|
|
"post": {
|
|
"summary": "Erstellt eine:n neue:n Benutzer:in mit einer Liste von Hobbies",
|
|
"requestBody": {
|
|
"description": "Name und Hobbies des neuen Benutzers/der neuen Benutzerin",
|
|
"required": true,
|
|
"content": {
|
|
"application/x-www-form-urlencoded": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Hobbies"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"$ref": "#/components/responses/SuccessResponse"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/BadRequestResponse"
|
|
},
|
|
"405": {
|
|
"$ref": "#/components/responses/MethodNotAllowedResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/update": {
|
|
"post": {
|
|
"summary": "Aktualisiert eine:n vorhandene:n Benutzer:in mit einer Liste von Hobbies",
|
|
"requestBody": {
|
|
"description": "Name und Hobbies des/der vorhandenen Benutzer:in",
|
|
"required": true,
|
|
"content": {
|
|
"application/x-www-form-urlencoded": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Hobbies"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"$ref": "#/components/responses/SuccessResponse"
|
|
},
|
|
"400": {
|
|
"$ref": "#/components/responses/BadRequestResponse"
|
|
},
|
|
"405": {
|
|
"$ref": "#/components/responses/MethodNotAllowedResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"Hobbies": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"example": "Lea"
|
|
},
|
|
"hobby": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"example": [
|
|
"reiten",
|
|
"backen"
|
|
]
|
|
},
|
|
"alter": {
|
|
"type": "integer",
|
|
"example": 23
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"SuccessResponse": {
|
|
"description": "Success",
|
|
"content": {
|
|
"text/html": {
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"BadRequestResponse": {
|
|
"description": "Bad Request",
|
|
"content": {
|
|
"text/html": {
|
|
"schema": {
|
|
"type": "string",
|
|
"example": "Kein POST-Formular gesendet"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"MethodNotAllowedResponse": {
|
|
"description": "Method not allowed",
|
|
"content": {
|
|
"text/html": {
|
|
"schema": {
|
|
"type": "string",
|
|
"example": "Nur POST-Methode erlaubt."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |