Chuyển tới nội dung chính

Giao thức chung

Giao thức chung (Base Protocol)

Tất cả request và response đều kế thừa các trường chung bên dưới. Phần RequestResponse của mỗi event chỉ hiển thị trường data riêng.

MiniAppRequestBase — Tất cả Request đều có

FieldTypeRequiredDescription
eventstringrequiredTên event (VD: GET_LOCATION)
senderstringrequiredNguồn gửi, mặc định "MINIAPP_WEBVIEW"
request_idstringrequiredID duy nhất của request, dùng để map response
dataobjectoptionalDữ liệu riêng của từng event (xem chi tiết bên dưới)

MiniAppResponseBase — Tất cả Response đều có

FieldTypeRequiredDescription
eventstringrequiredTên event tương ứng với request
senderstringrequiredNguồn gửi, mặc định "MINIAPP_SDK"
response_idstringrequiredID của response
request_idstringrequiredID của request tương ứng
eventStatusEventStatusrequiredTrạng thái xử lý (errorCode, errorMessageVN, errorMessageEN, realMsg)
errorDatastringoptionalDữ liệu lỗi chi tiết (nếu có)
messagestringoptionalThông báo bổ sung
dataobjectoptionalDữ liệu trả về riêng của từng event (xem chi tiết bên dưới)

EventStatus

FieldTypeDescription
errorCodestring"SDK000" = thành công. Dùng isSuccess(res) để kiểm tra
errorMessageVNstringThông báo lỗi tiếng Việt
errorMessageENstringThông báo lỗi tiếng Anh
realMsgstringThông báo gốc từ native