API LOCATION
- 1. Api Lấy thông tin quốc gia
- 2. Api Lấy thông tin tỉnh/thành
- 3. Api Lấy thông tin quận/huyện
- 4. Lấy thông tin phường/xã
1. Api Lấy thông tin quốc gia
- Api lấy quốc gia và tỉnh/thành của quốc gia đó.
1.1 Request
Method | URL |
GET | https://apis.haravan.com/com/countries.json |
Header: Content-Type: application/json
Authorization: Bearer #{access_token}
1.2 Response
Status | Response |
200 | {
"countries": [
{
"carrier_shipping_rate_providers": null,
"code": "TH",
"id": 243,
"name": "Thailand",
"price_based_shipping_rates": null,
"provinces": [],
"tax": null,
"weight_based_shipping_rates": null
},
{
"carrier_shipping_rate_providers": null,
"code": "USA",
"id": 242,
"name": "United States",
"price_based_shipping_rates": null,
"provinces": [],
"tax": null,
"weight_based_shipping_rates": null
},
{
"carrier_shipping_rate_providers": null,
"code": "VN",
"id": 241,
"name": "Vietnam",
"price_based_shipping_rates": null,
"provinces": [
{
"code": "DC",
"country_id": 241,
"id": 42,
"name": "Đắk Lắk",
"tax": null,
"tax_name": null,
"tax_type": null,
"tax_percentage": null
},
{
"code": "YB",
"country_id": 241,
"id": 10,
"name": "Yên Bái",
"tax": null,
"tax_name": null,
"tax_type": null,
"tax_percentage": null
}
],
"tax": null,
"weight_based_shipping_rates": null
}
]
}
|
STT | Thuộc tính | Mô tả |
1 | countries (array) | Danh sách quốc gia |
1.1 | carrier_shipping_rate_providers (string) | Nhà cung cấp giá vận chuyển |
1.2 | code (string) | Mã quốc gia |
1.3 | id (number) | Id quốc gia |
1.4 | price_based_shipping_rates (string) | Giá vận chuyển |
1.5 | provinces | Danh sách tỉnh/thành của quốc gia đó |
1.5.1 | code (string) | Mã tỉnh/thành |
1.5.2 | country_id (number) | Id quốc gia |
1.5.3 | id (number) | Id tỉnh/thành |
1.5.4 | name (string) | Tên tỉnh/thành |
1.5.5 | tax (string) | Thuế |
1.5.6 | tax_ name (string) | Tên thuế |
1.5.7 | tax_ type (string) | Loại thuế |
1.5.8 | tax_ percentage (number) | Phần trăm thuế |
1.6 | tax | Thuế |
1.7 | weight_based_shipping_rates | Giá vận chuyển dựa trên trọng lượng |
2. Api Lấy thông tin tỉnh/thành
- Api lấy danh sách tỉnh/thành theo id quốc gia.
2.1 Request
Method | URL |
GET | https://apis.haravan.com/com/countries/#{country_id}/provinces.json |
Header: Content-Type: application/json
Authorization: Bearer #{access_token}
STT | Thuộc tính | Mô tả |
1 | country_id (number)1 | Id quốc gia |
2.2 Response
Status | Response |
200 |
{
"provinces": [
{
"code": "HI",
"country_id": 241,
"id": 1,
"name": "Hà Nội",
"tax": null,
"tax_name": null,
"tax_type": null,
"tax_percentage": null
},
{
"code": "HG",
"country_id": 241,
"id": 2,
"name": "Hà Giang",
"tax": null,
"tax_name": null,
"tax_type": null,
"tax_percentage": null
}
]
}
|
STT | Thuộc tính | Mô tả |
1 | provinces | Danh sách tỉnh/thành của quốc gia đó |
1.1 | code (string) | Mã tỉnh/thành |
1.2 | country_id (number) | Id quốc gia |
1.3 | id (number) | Id tỉnh/thành |
1.4 | name (string) | Tên tỉnh/thành |
1.5 | tax (string) | Thuế |
1.6 | tax_ name (string) | Tên thuế |
1.7 | tax_ type (string) | Loại thuế |
1.8 | tax_ percentage (number) | Phần trăm thuế |
3. Api Lấy thông tin quận/huyện
- Api lấy danh sách quận/huyện theo id quốc gia.
3.1 Request
Method | URL |
GET | https://apis.haravan.com/com/countries/#{country_id}/districts.json |
Header: Content-Type: application/json
Authorization: Bearer #{access_token}
STT | Thuộc tính | Mô tả |
1 | country_id (number) | Id quốc gia |
3.2 Response
Status | Response |
200 |
{
"districts": [
{
"id": 4,
"name": "Quận Hoàn Kiếm",
"code": "HI4",
"province_id": 1
},
{
"id": 711,
"name": "Huyện Ứng Hòa",
"code": "HI711",
"province_id": 1
}
]
}
|
STT | Thuộc tính | Mô tả |
1 | districts | Danh sách quận/huyện của quốc gia đó |
1.1 | id (number) | Id quận/huyện |
1.2 | name (string) | Tên quận/huyện |
1.3 | code (string) | Mã quận/huyện |
1.4 | province_id (string) | Id tỉnh/thành tương ứng của quận/huyện |
4. Lấy thông tin phường/xã
- Tham khảo file đính kèm: wards.json
- Download file: https://github.com/Haravan/docs-omni/blob/master/Haravan%20API/carrier_services/source/wards.json