Files
portal-api/storage/api-docs/api-docs.json

985 lines
47 KiB
JSON

{
"openapi": "3.0.0",
"info": {
"title": "Portal API",
"description": "API Documentation for Portal Application",
"contact": {
"email": "admin@portal.com"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
},
"version": "1.0.0"
},
"servers": [
{
"url": "/api/v1",
"description": "API Server"
}
],
"paths": {
"/client/me": {
"get": {
"tags": [
"Client Authentication"
],
"summary": "Get current client information",
"description": "Returns the currently authenticated client's details",
"operationId": "getClientMe",
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"properties": {
"customer": {
"properties": {
"fullname": {
"type": "string",
"example": "Nguyen Van A"
},
"email": {
"type": "string",
"example": "client@example.com"
},
"phone": {
"type": "string",
"example": "0987654321"
},
"address": {
"type": "string",
"example": "123 Street"
},
"city": {
"type": "string",
"example": "Hanoi"
},
"ward": {
"type": "string",
"example": "Ward 1"
},
"province": {
"type": "string",
"example": "Hanoi"
},
"gender": {
"type": "string",
"example": "Nam"
},
"date": {
"type": "string",
"format": "date-time",
"example": "2024-01-01 12:00:00"
},
"company": {
"type": "string",
"example": "Company Ltd"
},
"avatar": {
"type": "string",
"example": "/uploads/avatar.jpg"
},
"cmnd_after": {
"type": "string",
"example": "cmnd_back.jpg"
},
"cmnd_before": {
"type": "string",
"example": "cmnd_front.jpg"
},
"cmnd": {
"type": "string",
"example": "123456789"
},
"fb_link": {
"type": "string",
"nullable": true
},
"active_2fa": {
"type": "integer",
"example": 0
},
"off_mail_marketing": {
"type": "integer",
"example": 0
},
"is_recharge_zalo": {
"type": "integer",
"example": 0
},
"is_verify_telegram": {
"type": "integer",
"example": 0
}
},
"type": "object"
},
"credit": {
"properties": {
"credit": {
"type": "number",
"example": 1000000
},
"total": {
"type": "number",
"example": 5000000
},
"point": {
"type": "number",
"example": 100
},
"point_used": {
"type": "integer",
"example": 0
},
"point_total": {
"type": "number",
"example": 100
}
},
"type": "object"
},
"service": {
"properties": {
"vps": {
"type": "integer",
"example": 2
},
"proxy": {
"type": "integer",
"example": 0
},
"server": {
"type": "integer",
"example": 0
},
"hosting": {
"type": "integer",
"example": 1
},
"domain": {
"type": "integer",
"example": 3
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Unauthenticated"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/client/login": {
"post": {
"tags": [
"Client Authentication"
],
"summary": "Client login",
"description": "Authenticate a client and return access token",
"operationId": "clientLogin",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string",
"format": "email",
"example": "client@example.com"
},
"password": {
"type": "string",
"format": "password",
"example": "password123"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Login successful",
"content": {
"application/json": {
"schema": {
"properties": {
"error": {
"type": "boolean",
"example": false
},
"data": {
"properties": {
"client": {
"type": "object"
},
"token": {
"type": "string",
"example": "1|laravel_sanctum_token..."
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Validation error"
}
}
}
},
"/client/register": {
"post": {
"tags": [
"Client Authentication"
],
"summary": "Client registration",
"description": "Register a new client account",
"operationId": "clientRegister",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"fullname",
"phone",
"email",
"password",
"password_confirmation"
],
"properties": {
"fullname": {
"type": "string",
"example": "Nguyen Van A"
},
"phone": {
"type": "string",
"example": "0987654321"
},
"email": {
"type": "string",
"format": "email",
"example": "client@example.com"
},
"password": {
"type": "string",
"format": "password",
"example": "password123"
},
"password_confirmation": {
"type": "string",
"format": "password",
"example": "password123"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Registration successful",
"content": {
"application/json": {
"schema": {
"properties": {
"error": {
"type": "boolean",
"example": false
},
"data": {
"properties": {
"client": {
"type": "object"
},
"token": {
"type": "string",
"example": "1|laravel_sanctum_token..."
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Validation error"
}
}
}
},
"/client/logout": {
"post": {
"tags": [
"Client Authentication"
],
"summary": "Client logout",
"description": "Logout the currently authenticated client",
"operationId": "clientLogout",
"responses": {
"200": {
"description": "Logout successful",
"content": {
"application/json": {
"schema": {
"properties": {
"error": {
"type": "boolean",
"example": false
},
"message": {
"type": "string",
"example": "Đã đăng xuất thành công."
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Unauthenticated"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/orders": {
"get": {
"tags": [
"Orders"
],
"summary": "Get list of orders",
"description": "Returns a list of orders for the authenticated customer",
"operationId": "getOrdersList",
"parameters": [
{
"name": "total_price",
"in": "query",
"description": "Filter by total price",
"required": false,
"schema": {
"type": "number"
}
},
{
"name": "pending",
"in": "query",
"description": "Filter by pending status",
"required": false,
"schema": {
"type": "boolean"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"properties": {
"success": {
"type": "boolean",
"example": true
},
"data": {
"type": "array",
"items": {
"type": "object"
}
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Unauthenticated"
}
},
"security": [
{
"bearerAuth": []
}
]
},
"post": {
"tags": [
"Orders"
],
"summary": "Create a new order",
"description": "Create a new order for a product",
"operationId": "storeOrder",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"product_id",
"billing_cycle"
],
"properties": {
"product_id": {
"description": "Product UUID",
"type": "string",
"example": "550e8400-e29b-41d4-a716-446655440000"
},
"billing_cycle": {
"type": "string",
"enum": [
"monthly",
"quarterly",
"semi_annually",
"annually",
"biennially"
],
"example": "monthly"
},
"server_name": {
"type": "string",
"example": "My VPS Server"
},
"os_id": {
"description": "Operating System ID",
"type": "integer",
"example": 1
},
"addons": {
"type": "array",
"items": {
"properties": {
"addon_id": {
"type": "integer",
"example": 1
},
"qty": {
"type": "integer",
"example": 1
}
},
"type": "object"
}
}
},
"type": "object"
}
}
}
},
"responses": {
"201": {
"description": "Order created successfully",
"content": {
"application/json": {
"schema": {
"properties": {
"success": {
"type": "boolean",
"example": true
},
"data": {
"type": "object"
},
"message": {
"type": "string",
"example": "Tạo đơn hàng thành công"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Unauthenticated"
},
"422": {
"description": "Validation error"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/orders/{id}/pay": {
"post": {
"tags": [
"Orders"
],
"summary": "Pay for an order",
"description": "Process payment for a specific order",
"operationId": "payOrder",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Order ID",
"required": true,
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"payment_method"
],
"properties": {
"payment_method": {
"type": "string",
"enum": [
"credit",
"vnpay",
"momo",
"bank_transfer"
],
"example": "credit"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Payment successful",
"content": {
"application/json": {
"schema": {
"properties": {
"success": {
"type": "boolean",
"example": true
},
"message": {
"type": "string",
"example": "Thanh toán thành công"
}
},
"type": "object"
}
}
}
},
"401": {
"description": "Unauthenticated"
},
"403": {
"description": "Forbidden - Not your order"
},
"404": {
"description": "Order not found"
}
},
"security": [
{
"bearerAuth": []
}
]
}
},
"/services/get-list": {
"get": {
"tags": [
"Services"
],
"summary": "Get list of services",
"description": "Returns a paginated list of active services/products",
"operationId": "getServiceList",
"parameters": [
{
"name": "limit",
"in": "query",
"description": "Number of items per page",
"required": false,
"schema": {
"type": "integer",
"default": 10
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"properties": {
"error": {
"type": "boolean",
"example": false
},
"message": {
"type": "string",
"example": "Lấy dữ liệu thành công"
},
"page_type": {
"type": "string",
"example": "service"
},
"data": {
"type": "array",
"items": {
"properties": {
"uuid": {
"type": "string",
"example": "550e8400-e29b-41d4-a716-446655440000"
},
"name": {
"type": "string",
"example": "Cloud VPS Basic"
},
"slug": {
"type": "string",
"example": "cloud-vps-basic"
},
"short_description": {
"type": "string",
"example": "Basic VPS plan"
},
"description": {
"type": "string"
},
"thumbnail": {
"type": "string",
"example": "https://example.com/images/vps.jpg"
},
"product_type": {
"type": "string",
"example": "vps"
},
"specs": {
"properties": {
"cpu": {
"type": "integer",
"example": 2
},
"ram": {
"type": "integer",
"example": 4
},
"disk": {
"type": "integer",
"example": 50
},
"bandwidth": {
"type": "integer",
"example": 1000
},
"gpu": {
"type": "string",
"nullable": true
}
},
"type": "object"
},
"stock": {
"type": "integer",
"example": 100
},
"price": {
"type": "number",
"example": 299000
},
"price_sale": {
"type": "number",
"example": 199000
},
"pricing": {
"type": "object"
},
"pricing_sale": {
"type": "object"
},
"group": {
"type": "string",
"example": "VPS"
},
"os": {
"type": "array",
"items": {
"properties": {
"group": {
"type": "string",
"example": "Ubuntu"
}
},
"type": "object"
}
}
},
"type": "object"
}
}
},
"type": "object"
}
}
}
}
}
}
},
"/services/{slug}": {
"get": {
"tags": [
"Services"
],
"summary": "Get service details",
"description": "Returns detailed information about a specific service/product",
"operationId": "getServiceDetail",
"parameters": [
{
"name": "slug",
"in": "path",
"description": "Service slug",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"properties": {
"error": {
"type": "boolean",
"example": false
},
"message": {
"type": "string",
"example": "Lấy dữ liệu thành công"
},
"page_type": {
"type": "string",
"example": "service"
},
"data": {
"properties": {
"uuid": {
"type": "string",
"example": "550e8400-e29b-41d4-a716-446655440000"
},
"name": {
"type": "string",
"example": "Cloud VPS Basic"
},
"slug": {
"type": "string",
"example": "cloud-vps-basic"
},
"short_description": {
"type": "string",
"example": "Basic VPS plan"
},
"description": {
"type": "string"
},
"thumbnail": {
"type": "string",
"example": "https://example.com/images/vps.jpg"
},
"product_type": {
"type": "string",
"example": "vps"
},
"specs": {
"properties": {
"cpu": {
"type": "integer",
"example": 2
},
"ram": {
"type": "integer",
"example": 4
},
"disk": {
"type": "integer",
"example": 50
},
"bandwidth": {
"type": "integer",
"example": 1000
},
"gpu": {
"type": "string",
"nullable": true
}
},
"type": "object"
},
"stock": {
"type": "integer",
"example": 100
},
"price": {
"type": "number",
"example": 299000
},
"price_sale": {
"type": "number",
"example": 199000
},
"group": {
"type": "string",
"example": "VPS"
},
"os": {
"type": "array",
"items": {
"properties": {
"name": {
"type": "string",
"example": "Ubuntu"
},
"thumbnail": {
"type": "string"
},
"versions": {
"type": "array",
"items": {
"properties": {
"version": {
"type": "string",
"example": "22.04"
},
"name": {
"type": "string",
"example": "Ubuntu 22.04 LTS"
}
},
"type": "object"
}
}
},
"type": "object"
}
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"404": {
"description": "Service not found"
}
}
}
},
"/setting": {
"get": {
"tags": [
"Settings"
],
"summary": "Get application settings",
"description": "Returns the application settings",
"operationId": "getSetting",
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "object"
},
"message": {
"type": "string",
"example": "Get setting successfully"
},
"error": {
"type": "boolean",
"example": false
}
},
"type": "object"
}
}
}
}
}
}
}
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT",
"description": "Enter your Bearer token in the format: Bearer {token}"
}
}
},
"tags": [
{
"name": "Client Authentication",
"description": "API Endpoints for Client Authentication"
},
{
"name": "Orders",
"description": "API Endpoints for Order Management"
},
{
"name": "Services",
"description": "API Endpoints for Services/Products"
},
{
"name": "Settings",
"description": "API Endpoints for Application Settings"
}
]
}