openapi: 3.0.0 info: title: PHP Course Exam version: 1.0.0 contact: name: Kilian Kurt Hofmann email: khofmann@zedat.fu-berlin.de description: PHP Course (ABV FU Berlin) 2024 Exam paths: /login: post: summary: Login description: Log in user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: 200: description: Success content: application/json: schema: $ref: "#/components/schemas/BooleanResponse" examples: Success: value: true 400: description: Missing Fields content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" examples: Missing Fields: value: { "message": "Missing email" } 401: description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" examples: Invalid Username or Password: value: { "message": "Invalid Username or Password" } 404: description: User not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" examples: User not Found: value: { "message": "User not Found" } 500: description: Failed content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" examples: Failed: value: { "message": "Login failed" } tags: - Login/Logout /logout: post: summary: Logout description: Log out User security: - BasicAuth: [] responses: 200: description: Success content: application/json: schema: $ref: "#/components/schemas/BooleanResponse" examples: Success: value: true tags: - Login/Logout /user{id}: get: summary: Get user description: Get user by ID security: - BasicAuth: [] parameters: - name: id in: path description: User ID required: true schema: type: integer format: int14 responses: 200: description: Success content: application/json: schema: $ref: "#/components/schemas/UserResponse" examples: Success: value: { "id": 1, "username": "Admin", "status": 1, "email": "marvin@zedat.fu-berlin.de", "image": "profilbilder\\/admin.svg", "isAdmin": true, } 404: description: User not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" examples: User not Found: value: { "message": "User not Found" } tags: - User post: summary: Update user description: Update user with ID. Fields are updated in order username,password,image. If one fails, subsequent are not updated security: - BasicAuth: [] parameters: - name: id in: path description: User ID required: true schema: type: integer format: int14 requestBody: content: application/json: schema: $ref: "#/components/schemas/UserUpdateRequest" responses: 200: description: Success content: application/json: schema: $ref: "#/components/schemas/BooleanResponse" examples: Success: value: true 404: description: User not Found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" examples: User not Found: value: { "message": "User not Found" } 500: description: Update failed content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" examples: User not Found: value: { "message": "Failed to update username" } tags: - User externalDocs: url: https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/docs/ security: [] servers: - url: https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/ description: "" variables: {} components: links: {} callbacks: {} schemas: BooleanResponse: type: boolean ErrorResponse: type: object properties: message: type: string LoginRequest: type: object required: - username - password properties: username: type: string password: type: string UserResponse: type: object properties: id: type: number username: type: string status: type: number email: type: string image: type: string nullable: true isAdmin: type: boolean UserUpdateRequest: type: object properties: username: type: string password: type: string image: type: string securitySchemes: BasicAuth: type: apiKey name: token in: header tags: - name: Login/Logout - name: User