{ "openapi": "3.0.2", "info": { "title": "API Users", "version": "1.0" }, "servers": [{ "url": "https://localhost:8000" }], "paths": { "/api/users": { "post": { "description": "Register new user", "requestBody": { "content": { "application/json": { "example": { "description": "Register user catura", "value": { "username": "catura", "firstname": "catura", "password": "blabla", "email": "catura@gmail.com" } }, "schema": { "type": "object", "required": [ "username", "firstname", "password", "email" ], "properties": { "username": { "type": "string" }, "firstname": { "type": "string" }, "lastname": { "type": "string" }, "password": { "type": "string" }, "email": { "type": "string" } } } } } }, "responses": { "201": { "description": "Success register user", "content": { "application/json": { "examples": { "success": { "description": "Success register user", "value": { "data": { "id": 1, "username": "catura", "firstname": "catura", "email": "catura@gmail.com" } } } }, "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "number" }, "username": { "type": "string" }, "firstname": { "type": "string" }, "email": { "type": "string" } } }, "errors": { "type": "object" } } } } } }, "400": { "description": "Validation error", "content": { "application/json": { "examples": { "validationerror": { "description": "Validation error", "value": { "error": { "username": [ "username must not be blank", "username min 6 characters" ], "email": [ "email already exist", "email invalid" ] } } } } } } } } } }, "/api/users/login": { "post": { "description": "Login user", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "username": { "type": "string" }, "password": { "type": "string" } } } } } }, "responses": { "200": { "description": "Success login", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "number" }, "username": { "type": "string" }, "firstname": { "type": "string" }, "email": { "type": "string" }, "token": { "type": "string" } } }, "errors": { "type": "object" } } } } } } } } }, "/api/users/current": { "get": { "description": "Get current user", "parameters": [ { "name": "X-User-Token/Authorization", "in": "header" } ], "responses": { "200": { "description": "Success get current user", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "number" }, "username": { "type": "string" }, "firstname": { "type": "string" }, "email": { "type": "string" } } }, "errors": { "type": "object" } } } } } } } }, "patch": { "description": "Update current user", "parameters": [ { "name": "X-User-Token/Authorization", "in": "header" } ], "requestBody": { "description": "Update current user", "content": { "application/json": { "schema": { "type": "object", "properties": { "username": { "type": "string" }, "password": { "type": "string" }, "firstname": { "type": "string" }, "lastname": { "type": "string" }, "email": { "type": "string" } } } } } }, "responses": { "200": { "description": "Success update user", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "number" }, "username": { "type": "string" }, "firstname": { "type": "string" }, "email": { "type": "string" } } }, "errors": { "type": "object" } } } } } } } } }, "/api/users/logout": { "delete": { "description": "Logout user", "parameters": [ { "name": "X-User-Token/Authorization", "in": "header" } ], "responses": { "200": { "description": "Success logout user", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "boolean" }, "errors": { "type": "object" } } } } } } } } } } }