Integrations
POS, shipping and payment connections: call adapter actions. · 9 endpoints
- 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
Configured integrations
GET
/api/v1/integrationsScope: integrations:readExample request
bash
curl "http://127.0.0.1:9900/api/v1/integrations" \
-H "Authorization: Bearer dpk_xxx"Add an integration (credentials are encrypted and never returned)
POST
/api/v1/integrationsScope: integrations:manageRequest body (JSON)
typerequired | "kiotviet" | "haravan" | "sapo" | "nhanh" | "pancake" | "casso" | "sepay" | "ghn" | "ghtk" | "telegram_bot" | Xem GET /integrations/types |
nameoptional | string max 100 | Empty = the integration type's name |
enabledoptional | boolean default true | |
credentialsrequired | object | Keys as listed by GET /integrations/types |
settingsoptional | object |
Example request
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"}}'Get an integration (without credentials)
GET
/api/v1/integrations/{integrationId}Scope: integrations:readParameters
integrationIdpath · required | string max 200 |
Example request
bash
curl "http://127.0.0.1:9900/api/v1/integrations/{integrationId}" \
-H "Authorization: Bearer dpk_xxx"Update an integration: name, settings, credentials (empty = keep the current ones), on/off
PATCH
/api/v1/integrations/{integrationId}Scope: integrations:manageParameters
integrationIdpath · required | string max 200 |
Request body (JSON)
nameoptional | string max 100 | |
enabledoptional | boolean | |
credentialsoptional | object | |
settingsoptional | object |
Example request
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":{}}'Delete an integration (workflows that use it will fail when they run)
DELETE
/api/v1/integrations/{integrationId}Scope: integrations:manageParameters
integrationIdpath · required | string max 200 |
Example request
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/integrations/{integrationId}" \
-H "Authorization: Bearer dpk_xxx"Call an adapter action (e.g. lookupOrder, createOrder, getTracking)
POST
/api/v1/integrations/{integrationId}/actions/{action}Scope: integrations:executeAction names and parameters are the same as the corresponding workflow node (e.g. node nhanh.lookupOrder ↔ action lookupOrder).
Parameters
integrationIdpath · required | string max 200 | |
actionpath · required | string max 100 |
Request body (JSON)
paramsoptional | object default {} |
Example request
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"}}'Supported integration types and the credential / settings keys they require
GET
/api/v1/integrations/typesScope: integrations:readExample request
bash
curl "http://127.0.0.1:9900/api/v1/integrations/types" \
-H "Authorization: Bearer dpk_xxx"Call an action by integration type (uses the enabled integration of that type)
POST
/api/v1/integrations/by-type/{type}/actions/{action}Scope: integrations:executeHandy when you have only one integration of each type, like workflow nodes (e.g. ghn + getTracking).
Parameters
typepath · required | "kiotviet" | "haravan" | "sapo" | "nhanh" | "pancake" | "casso" | "sepay" | "ghn" | "ghtk" | "telegram_bot" | |
actionpath · required | string max 100 |
Request body (JSON)
paramsoptional | object default {} |
Example request
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":{}}'Test the integration's connection
POST
/api/v1/integrations/{integrationId}/testScope: integrations:executeParameters
integrationIdpath · required | string max 200 |
Example request
bash
curl -X POST "http://127.0.0.1:9900/api/v1/integrations/{integrationId}/test" \
-H "Authorization: Bearer dpk_xxx"