1. Overview
Vietnamese version, visit docs.giaohangtietkiem.vn.
1.1. Endpoint & Variables
These variables will be used in this API document.
Variables | Description | STAGING | PRODUCTION |
---|---|---|---|
OPEN_API | Open API services | https://services-staging.ghtklab.com | https://services.giaohangtietkiem.vn |
CUSTOMER_WEBSITE | Customer website | https://khachhang-staging.ghtklab.com | https://khachhang.giaohangtietkiem.vn |
Variables | Description |
---|---|
API_TOKEN | This API token key can be found on customer websites. These token could be located at {website}/web/thong-tin-shop/tai-khoan |
PARTNER_CODE | Shop code or Private partner code |
MESSAGE | API response message |
ERROR_MESSAGE | Error message for failed request |
LOG_ID | Log iD for tracing |
1.2. Token header
After registering an account with GHTK, you could find your API token
- Log in to our website: {CUSTOMER_WEBSITE}
- Open the link: {CUSTOMER_WEBSITE}/web/thong-tin-shop/tai-khoan
- Find your API token in the top left sidebar, under “Shop Information.”
You need to set this token string into “Token” headers for every request sent to GHTK APIs.
Request sent via API is verified by Token in request’s header
GET /authentication-request-sample HTTP/1.1
Host: {OPEN_API}
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}
Note: replace {API_TOKEN} by your token.
1.3. Request format
GHTK API supports 2 content types: application/x-www-form-urlencoded and application/json.
- API requests need to be in either x-www-form or json.
- Default is application/x-www-form-urlencoded
application/x-www-form-urlencoded
POST /request-sample HTTP/1.1
Host: {OPEN_API}
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}
Content-Type:application/x-www-form-urlencoded
field1=value1&field2=value2
application/json
POST /request-sample HTTP/1.1
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}
Content-Type:application/x-www-form-urlencoded
{"field1":value1,"field2":value2}
1.4. Response format
Token verification failed:
HTTP/1.1 403 Forbidden Content-Type:application/json; charset=UTF-8 Content-Length: 0
Token verification succeeded
Content type: JSON
Token verification succeeded but error occurred
Content type: JSON