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:

FieldLoạiBắt buộcMô tả
filefileFile ảnh (jpeg, png, webp, gif, svg+xml)
folderstringKhôngThư mục lưu
alt_textstringKhôngAlt text
convert_tostringKhôngChuyển đổi format: jpg, jpeg, png, gif
max_widthintKhôngChiều rộng tối đa (resize)
max_heightintKhôngChiều cao tối đa
widthintKhôngChiều rộng cố định
heightintKhôngChiề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"}}