Tasks Giao Việc

Tài liệu API cho app

Không cần đăng nhập. Copy base URL, header và các key bên dưới.

Base URL

https://tasks.duhocsunny.com/api

Trang này: https://tasks.duhocsunny.com/api-docs

Header / key bắt buộc

App gửi các key này trên mọi request.

Key Giá trị
Accept bắt buộc application/json

Luôn gửi trên mọi request.

Content-Type bắt buộc application/json

Bắt buộc khi gửi body JSON (login, gửi tin chat).

Authorization Bearer {token}

Bắt buộc với mọi API trừ login và docs. {token} lấy từ POST /api/login.

Ví dụ: Authorization: Bearer 1|xxxxxxxx — token lấy từ POST /api/login.
POST /api/login không cần đăng nhập

Đăng nhập

URL đầy đủ: https://tasks.duhocsunny.com/api/login

Header: Accept, Content-Type

Body JSON

Key trả về

Ví dụ body

{
    "email": "admin@example.com",
    "password": "********",
    "device_name": "android-app"
}
GET /api/me cần token

Thông tin thành viên đang đăng nhập

URL đầy đủ: https://tasks.duhocsunny.com/api/me

Header: Accept, Authorization

Key trả về

POST /api/logout cần token

Đăng xuất

URL đầy đủ: https://tasks.duhocsunny.com/api/logout

Header: Accept, Authorization

Key trả về

GET /api/docs không cần đăng nhập

Danh mục API (JSON)

URL đầy đủ: https://tasks.duhocsunny.com/api/docs

Header: Accept

Key trả về

GET /api/cong-viec cần token

Danh sách công việc

URL đầy đủ: https://tasks.duhocsunny.com/api/cong-viec

Header: Accept, Authorization

Query

Key trả về

GET /api/cong-viec/{id} cần token

Chi tiết công việc

URL đầy đủ: https://tasks.duhocsunny.com/api/cong-viec/{id}

Header: Accept, Authorization

Key trả về

GET /api/chat cần token

Danh sách hội thoại chat

URL đầy đủ: https://tasks.duhocsunny.com/api/chat

Header: Accept, Authorization

Query

Key trả về

GET /api/chat/tim cần token

Tìm tin nhắn

URL đầy đủ: https://tasks.duhocsunny.com/api/chat/tim

Header: Accept, Authorization

Query

Key trả về

GET /api/chat/moi cần token

Tin mới từ người khác

URL đầy đủ: https://tasks.duhocsunny.com/api/chat/moi

Header: Accept, Authorization

Query

Key trả về

GET /api/chat/{id} cần token

Tóm tắt công việc trong chat

URL đầy đủ: https://tasks.duhocsunny.com/api/chat/{id}

Header: Accept, Authorization

Key trả về

GET /api/chat/{id}/tin cần token

Danh sách tin nhắn

URL đầy đủ: https://tasks.duhocsunny.com/api/chat/{id}/tin

Header: Accept, Authorization

Query

Key trả về

POST /api/chat/{id}/tin cần token

Gửi tin nhắn

URL đầy đủ: https://tasks.duhocsunny.com/api/chat/{id}/tin

Header: Accept, Content-Type, Authorization

Body JSON

Key trả về

Ví dụ body

{
    "body": "Đã nhận việc, báo cáo cuối ngày.",
    "reply_to_id": 80
}
PUT /api/chat/{id}/tin/{comment_id}/ghim cần token

Ghim / bỏ ghim tin

URL đầy đủ: https://tasks.duhocsunny.com/api/chat/{id}/tin/{comment_id}/ghim

Header: Accept, Authorization

Key trả về

DELETE /api/chat/{id}/tin/{comment_id} cần token

Xóa tin nhắn

URL đầy đủ: https://tasks.duhocsunny.com/api/chat/{id}/tin/{comment_id}

Header: Accept, Authorization

Key trả về

GET /api/thong-bao cần token

Danh sách thông báo của tôi

URL đầy đủ: https://tasks.duhocsunny.com/api/thong-bao

Header: Accept, Authorization

Query

Key trả về

GET /api/thong-bao/moi cần token

Poll thông báo mới (cho push app)

URL đầy đủ: https://tasks.duhocsunny.com/api/thong-bao/moi

Header: Accept, Authorization

Query

Key trả về

PUT /api/thong-bao/{id}/doc cần token

Đánh dấu một thông báo đã đọc

URL đầy đủ: https://tasks.duhocsunny.com/api/thong-bao/{id}/doc

Header: Accept, Authorization

Key trả về

POST /api/thong-bao/doc-tat-ca cần token

Đánh dấu tất cả đã đọc

URL đầy đủ: https://tasks.duhocsunny.com/api/thong-bao/doc-tat-ca

Header: Accept, Authorization

Key trả về

Toàn bộ key trong notification

Object này trả về ở /api/thong-bao và /api/thong-bao/moi. App poll /moi rồi hiện push local bằng title + message.

Key Kiểu Ý nghĩa
id string UUID thông báo. App khử trùng khi hiện push.
title string Tiêu đề push, ví dụ Có công việc mới được giao.
message string Nội dung push.
event string|null Mã sự kiện: task_created, task_comment, item_submitted, item_completed…
task_id integer|null Mã việc để mở /api/cong-viec/{id} hoặc /app/cong-viec/{id}.
report_code string|null Mã báo cáo phòng, nếu thông báo về báo cáo.
read boolean Đã đọc hay chưa.
time string|null Giờ hiển thị, d/m/Y H:i.
created_at string|null ISO 8601. Dùng làm after khi poll.

Toàn bộ key trong task

Object này trả về ở /api/cong-viec và /api/cong-viec/{id}.

Key Kiểu Ý nghĩa
id integer Mã công việc.
name string Tên việc lớn.
status string todo, processing, pending_review, completed.
status_label string Nhãn tiếng Việt.
priority boolean Việc ưu tiên.
overdue boolean Việc lớn quá hạn.
deadline string|null Hạn, Y-m-d H:i:s.
deadline_label string|null Hạn, d/m/Y H:i.
content string Nội dung chữ thường.
content_html string Nội dung HTML.
creator object|null Người giao: id, name.
responsible object|null Người phụ trách: id, name.
assignees array Người thực hiện: [{id, name}].
documents array Tài liệu việc lớn: id, name, url, icon.
items array Danh sách việc nhỏ.
items[].id integer Mã việc nhỏ.
items[].name string Tên việc nhỏ.
items[].status string todo, processing, pending_review, completed.
items[].status_label string Nhãn tiếng Việt.
items[].overdue boolean Việc nhỏ quá hạn.
items[].deadline string|null Hạn việc nhỏ.
items[].content string Nội dung việc nhỏ.
items[].report string Báo cáo hoàn thành (chữ thường).
items[].report_html string Báo cáo HTML.
items[].responsible object|null Người phụ trách việc nhỏ.
items[].assignees array Người làm việc nhỏ.
items[].documents array Tài liệu gắn việc nhỏ.
items_count integer Số việc nhỏ.
overdue_items_count integer Số việc nhỏ quá hạn.

Toàn bộ key trong member

Object này trả về ở /api/login và /api/me.

Key Kiểu Ý nghĩa
id integer Mã thành viên.
name string Họ và tên.
email string Email đăng nhập.
phone string|null Số điện thoại.
is_admin boolean Quản trị hệ thống.
is_active boolean Tài khoản còn hoạt động.
is_ceo boolean Chức vụ CEO.
is_department_manager boolean Trưởng/phó phòng.
position string|null Mã chức vụ: ceo, truong_phong, pho_phong, nhan_vien.
position_label string Tên chức vụ tiếng Việt.
extra_position string|null Ghi thêm chức vụ.
department_id integer|null Mã phòng ban.
department object|null Phòng ban: id, name, description.
department.id integer Mã phòng.
department.name string Tên phòng.
department.description string|null Mô tả phòng.
reporting_departments array Phòng được giao viết báo cáo.
reporting_departments[].id integer Mã phòng báo cáo.
reporting_departments[].name string Tên phòng báo cáo.
telegram_connected boolean Đã kết nối Telegram.
telegram_connected_at string|null Thời điểm kết nối, ISO 8601.
must_change_password boolean Bắt buộc đổi mật khẩu.
uses_admin_ui boolean Dùng giao diện admin/CEO.
home_path string Đường dẫn trang chủ web.
permissions object Quyền trên app.
permissions.can_create_tasks boolean Được giao việc.
permissions.can_create_members boolean Được thêm thành viên.
permissions.can_view_company_wide boolean Xem toàn công ty.
permissions.can_manage_departments boolean Sửa phòng ban.
permissions.can_view_departments boolean Xem danh sách phòng.
permissions.can_view_staff_work_report boolean Xem báo cáo nhân sự / cân việc.
permissions.can_view_report_config boolean Xem cấu hình báo cáo phòng.
permissions.is_report_writer boolean Được viết báo cáo phòng.
email_verified_at string|null Thời điểm xác thực email.
created_at string|null Ngày tạo tài khoản.
updated_at string|null Ngày cập nhật.