Tích hợp
Kết nối POS, vận chuyển, thanh toán: gọi action của adapter. · 9 endpoint
- GET/integrations
- POST/integrations
- GET/integrations/{integrationId}
- PATCH/integrations/{integrationId}
- DELETE/integrations/{integrationId}
- POST/integrations/{integrationId}/actions/{action}
- GET/integrations/types
- POST/integrations/by-type/{type}/actions/{action}
- POST/integrations/{integrationId}/test
Danh sách tích hợp đã cấu hình
GET
/api/v1/integrationsScope: integrations:readLệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/integrations" \
-H "Authorization: Bearer dpk_xxx"Thêm tích hợp (credential được mã hoá, không bao giờ trả ra)
POST
/api/v1/integrationsScope: integrations:manageBody (JSON)
typebắt buộc | "kiotviet" | "haravan" | "sapo" | "nhanh" | "pancake" | "casso" | "sepay" | "ghn" | "ghtk" | "telegram_bot" | Xem GET /integrations/types |
nametuỳ chọn | string max 100 | Bỏ trống = tên loại tích hợp |
enabledtuỳ chọn | boolean default true | |
credentialsbắt buộc | object | Khoá theo GET /integrations/types |
settingstuỳ chọn | object |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/integrations" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"type":"ghn","credentials":{"token":"ghn_xxx","shopId":"123456"},"settings":{"environment":"production"}}'Một tích hợp (không có credential)
GET
/api/v1/integrations/{integrationId}Scope: integrations:readTham số
integrationIdpath · bắt buộc | string max 200 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/integrations/{integrationId}" \
-H "Authorization: Bearer dpk_xxx"Sửa tích hợp: tên, cài đặt, credential (bỏ trống = giữ cũ), bật/tắt
PATCH
/api/v1/integrations/{integrationId}Scope: integrations:manageTham số
integrationIdpath · bắt buộc | string max 200 |
Body (JSON)
nametuỳ chọn | string max 100 | |
enabledtuỳ chọn | boolean | |
credentialstuỳ chọn | object | |
settingstuỳ chọn | object |
Lệnh mẫu
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/integrations/{integrationId}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","enabled":false,"credentials":{}}'Xoá tích hợp (workflow dùng tích hợp này sẽ báo lỗi khi chạy)
DELETE
/api/v1/integrations/{integrationId}Scope: integrations:manageTham số
integrationIdpath · bắt buộc | string max 200 |
Lệnh mẫu
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/integrations/{integrationId}" \
-H "Authorization: Bearer dpk_xxx"Gọi một action của adapter (vd: lookupOrder, createOrder, getTracking)
POST
/api/v1/integrations/{integrationId}/actions/{action}Scope: integrations:executeTên action và tham số giống node workflow tương ứng (vd. node nhanh.lookupOrder ↔ action lookupOrder).
Tham số
integrationIdpath · bắt buộc | string max 200 | |
actionpath · bắt buộc | string max 100 |
Body (JSON)
paramstuỳ chọn | object default {} |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/integrations/{integrationId}/actions/{action}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"params":{"orderId":"DH2291"}}'Loại tích hợp hỗ trợ và các khoá credential / cài đặt cần nhập
GET
/api/v1/integrations/typesScope: integrations:readLệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/integrations/types" \
-H "Authorization: Bearer dpk_xxx"Gọi action theo loại tích hợp (dùng tích hợp đang bật của loại đó)
POST
/api/v1/integrations/by-type/{type}/actions/{action}Scope: integrations:executeTiện khi chỉ có một tích hợp mỗi loại, như node workflow (vd. ghn + getTracking).
Tham số
typepath · bắt buộc | "kiotviet" | "haravan" | "sapo" | "nhanh" | "pancake" | "casso" | "sepay" | "ghn" | "ghtk" | "telegram_bot" | |
actionpath · bắt buộc | string max 100 |
Body (JSON)
paramstuỳ chọn | object default {} |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/integrations/by-type/{type}/actions/{action}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"params":{}}'Kiểm tra kết nối của tích hợp
POST
/api/v1/integrations/{integrationId}/testScope: integrations:executeTham số
integrationIdpath · bắt buộc | string max 200 |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/integrations/{integrationId}/test" \
-H "Authorization: Bearer dpk_xxx"