25

REST API

FIT HCMUTE SUB-SYSTEM

Version: v1.0.0

API Reference

Welcome to the official developer documentation for the FIT HCMUTE 25th Anniversary platform. This API provides programmatic access to user management, article provisioning, media capabilities, and core configurations.

Base URL: http://localhost:3000
Authentication: JWT Bearer

Auth

POST /auth/login

Description

Đăng nhập lấy Access Token

Parameters

application/json
{
  "email": "admin@hcmute.edu.vn",
  "password": "mypassword123"
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/auth/login \\
  -H "Content-Type: application/json" \\
  -d '{"email":"admin@hcmute.edu.vn","password":"mypassword123"}'

Users

POST /v1/users

Description

Tạo tài khoản người dùng mới (Admin)

Parameters

application/json
{
  "name": "Nguyen Van A",
  "email": "a@hcmute.edu.vn",
  "role": "USER"
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/v1/users \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Nguyen Van A","email":"a@hcmute.edu.vn","role":"USER"}'
GET /v1/users?page=1&limit=10

Description

Lấy danh sách người dùng phân trang

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/v1/users?page=1&limit=10 \\
  -H "Authorization: Bearer <YOUR_TOKEN>"
GET /v1/users/:id

Description

Lấy thông tin chi tiết của 1 tài khoản

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/v1/users/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>"
PATCH /v1/users/:id

Description

Cập nhật thông tin tài khoản

Parameters

application/json
{
  "name": "Nguyen Van B"
}

Example Request (cURL)

curl -X PATCH \\
  http://localhost:3000/v1/users/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"name":"Nguyen Van B"}'
DELETE /v1/users/:id

Description

Xoá tài khoản khỏi hệ thống

Example Request (cURL)

curl -X DELETE \\
  http://localhost:3000/v1/users/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>"

Articles

POST /articles

Description

Tạo bài viết, bản tin mới

Parameters

application/json
{
  "title": "Hội thảo khoa học 2024",
  "content": "<p>Nội dung HTML bài viết...</p>",
  "category": "EVENT"
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/articles \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Hội thảo khoa học 2024","content":"<p>Nội dung HTML bài viết...</p>","category":"EVENT"}'
GET /articles?page=1&limit=10

Description

Lấy danh sách bài viết public

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/articles?page=1&limit=10
GET /articles/:slug

Description

Lấy chi tiết 1 bài viết theo URL Slug

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/articles/:slug
PATCH /articles/:id

Description

Chỉnh sửa bài viết (Chỉ Author/Admin)

Parameters

application/json
{
  "title": "Tiêu đề mới"
}

Example Request (cURL)

curl -X PATCH \\
  http://localhost:3000/articles/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Tiêu đề mới"}'
DELETE /articles/:id

Description

Xoá bài viết

Example Request (cURL)

curl -X DELETE \\
  http://localhost:3000/articles/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>"

Albums

POST /albums

Description

Tạo Album ảnh kỷ niệm mới

Parameters

application/json
{
  "title": "Khoảnh khắc 25 năm FIT",
  "description": "Những bức ảnh đẹp"
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/albums \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Khoảnh khắc 25 năm FIT","description":"Những bức ảnh đẹp"}'
GET /albums

Description

Xem tất cả Album ảnh

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/albums
GET /albums/:id

Description

Xem chi tiết Album (bao gồm mảng ảnh media)

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/albums/:id
PATCH /albums/:id

Description

Cập nhật Album ảnh

Parameters

application/json
{
  "coverId": "uuid-123"
}

Example Request (cURL)

curl -X PATCH \\
  http://localhost:3000/albums/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"coverId":"uuid-123"}'
DELETE /albums/:id

Description

Xoá Album

Example Request (cURL)

curl -X DELETE \\
  http://localhost:3000/albums/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>"

Forms

POST /forms

Description

Tạo một form khảo sát động

Parameters

application/json
{
  "title": "Đăng ký tham gia Gala 25 năm",
  "fields": [
    {
      "name": "phone",
      "label": "Số điện thoại",
      "type": "TEXT"
    }
  ]
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/forms \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"title":"Đăng ký tham gia Gala 25 năm","fields":[{"name":"phone","label":"Số điện thoại","type":"TEXT"}]}'
GET /forms

Description

Lấy danh sách các biểu mẫu

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/forms \\
  -H "Authorization: Bearer <YOUR_TOKEN>"
GET /forms/:slug

Description

Lấy chi tiết 1 biểu mẫu (dùng cho frontend render thẻ form)

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/forms/:slug
PATCH /forms/:id

Description

Cập nhật cấu trúc của biểu mẫu

Parameters

application/json
{
  "isActive": false
}

Example Request (cURL)

curl -X PATCH \\
  http://localhost:3000/forms/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -H "Content-Type: application/json" \\
  -d '{"isActive":false}'
DELETE /forms/:id

Description

Xoá biểu mẫu

Example Request (cURL)

curl -X DELETE \\
  http://localhost:3000/forms/:id \\
  -H "Authorization: Bearer <YOUR_TOKEN>"
POST /forms/:slug/submit

Description

Khách gửi dữ liệu (response) vào biểu mẫu

Parameters

application/json
{
  "data": {
    "phone": "0987654321"
  }
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/forms/:slug/submit \\
  -H "Content-Type: application/json" \\
  -d '{"data":{"phone":"0987654321"}}'

Media

POST /media/upload

Description

Tải 1 file lên hệ thống (MinIO)

Parameters

multipart/form-data
{
  "file": "@path/to/image.jpg"
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/media/upload \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -F "file=@path/to/image.jpg"
POST /media/upload-batch

Description

Tải nhiều file một lúc vào hệ thống

Parameters

multipart/form-data
{
  "files": "[@path/img1.jpg, @path/img2.jpg]"
}

Example Request (cURL)

curl -X POST \\
  http://localhost:3000/media/upload-batch \\
  -H "Authorization: Bearer <YOUR_TOKEN>" \\
  -F "files=[@path/img1.jpg, @path/img2.jpg]"

Audit Logs

GET /v1/audit-logs

Description

Xem lịch sử thao tác hệ thống (Admin Only)

Example Request (cURL)

curl -X GET \\
  http://localhost:3000/v1/audit-logs \\
  -H "Authorization: Bearer <YOUR_TOKEN>"

© 2024 HCMUTE RTIC. System Documentations natively generated.