API Lấy mã Quận/Huyện
Sử dụng API này để lấy danh sách mã Quận/Huyện để tạo đơn hàng.
Lưu ý : API này cần truyền token ở header.
post/gethttps://online-gateway.ghn.vn/shiip/public-api/master-data/district
https://dev-online-gateway.ghn.vn/shiip/public-api/master-data/district
curl --location --request GET 'https://dev-online-gateway.ghn.vn/shiip/public-api/master-data/district' \
--header 'token: 637170d5-942b-11ea-9821-0281a26fb5d4' \
--header 'Content-Type: application/json' \
--data-raw '{
"province_id":201
}'
Cấu trúc Request
Trường dữ liệu | Kiểu dữ liệu | Mô tả |
---|---|---|
token | String |
Dùng để xác định định danh của tài khoản và dùng cho các trường hợp gọi tới các API. |
province_id | Int |
Mã Tỉnh/Thành được lấy ở API Lấy danh sách mã Tỉnh/ Thành. |
{
"code": 200,
"message": "Success",
"data":
{
"DistrictID": 3695,
"ProvinceID": 202,
"DistrictName": "Thành Phố Thủ Đức",
"Code": 3695,
"Type": 3,
"SupportType":3,
"NameExtension": [
"TP Thủ Đức",
"thành phố thủ đức",
"TP. Thủ Đức",
"TP. Thu Duc",
"thuduc"
],
"IsEnable":1,
"CanUpdateCOD":"false",
"Status":1,
"CreatedDate":"2020-12-25T08:02:27.479Z",
"UpdatedDate":"2021-09-03T07:43:25.338Z"
....
}
}
Cấu trúc Response
Trường dữ liệu | Mô tả |
---|---|
DistrictID |
Mã Quận/Huyện. |
ProvinceID |
Mã Tỉnh/Thành. |
DistrictName |
Tên Quận/Huyện. |
SupportType |
Loại hỗ trợ:
|
NameExtension |
Tên mở rộng. |
CanUpdateCOD |
Có thể cập nhật tiền thu hộ:
|
Status |
Trạng thái:
|
CreatedDate |
Thời gian tạo. |
UpdatedDate |
Thời gian cập nhật. |
{
"code": 400,
"message": "code=400, message=Syntax error: offset=30, error=invalid character '}' after array element",
"data": null
"code_message": "USER_ERR_COMMON"
}