Media API#
Upload và quản lý media files (MinIO storage).
Base URL: https://apitest.likepion.com/api/v1/media
Auth: JWT Token (Authorization: Bearer <token>)
POST /media/upload — Upload file #
Content-Type: multipart/form-data (max 10MB)
Form fields:
| Field | Loại | Bắt buộc | Mô tả |
|---|---|---|---|
file | file | Có | File ảnh (jpeg, png, webp, gif, svg+xml) |
folder | string | Không | Thư mục lưu |
alt_text | string | Không | Alt text |
convert_to | string | Không | Chuyển đổi format: jpg, jpeg, png, gif |
max_width | int | Không | Chiều rộng tối đa (resize) |
max_height | int | Không | Chiều cao tối đa |
width | int | Không | Chiều rộng cố định |
height | int | Không | Chiều cao cố định |
Response (201):
{
"success": true,
"data": {
"id": "uuid",
"url": "https://storage.example.com/media/image.png",
"public_id": "media/image.png",
"name": "image.png",
"type": "image",
"alt_text": "Description",
"folder": "gallery",
"size": 102400,
"mime_type": "image/png",
"uploaded_by": "uuid",
"created_at": "2025-06-01T00:00:00Z"
}
}GET /media — Danh sách files #
Query: folder, page (mặc định 1), limit (mặc định 20)
Response:
{
"success": true,
"data": [...],
"total": 50,
"page": 1,
"limit": 20
}DELETE /media/:id — Xóa file #
Response:
{"success": true, "data": {"deleted": "uuid"}}