Other
The other APIs return the reference data a storefront needs: phone codes, currencies, countries, provinces, the country the visitor is browsing from, the currencies the store has enabled, the coupons a product offers, and the language pack of the theme.
List country calling codes
GET /{locale}/api/phone
Get phone-related information data.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/phone')
.then((response) => response.json())
.then((data) => {
// Do something...
});
Response
- Schema
- Example
- Array [
- ]
Chinese name of the country.
URL of the flag image.
ISO 3166-1 alpha-2 country code.
ISO 3166-1 alpha-3 country code.
English name of the country.
International dialling code of the country.
Key combining the country code and the dialling code, for example AF_93.
[
{
"cn_name": "阿富汗",
"flag": "https://imglib.shoplazza.com/42757bc371af7061a1775697529b55c6.png",
"iso_code_2": "AF",
"iso_code_3": "AFG",
"name": "Afghanistan",
"phone_code": "93",
"phone_key": "AF_93"
},
{
"cn_name": "奥兰群岛",
"flag": "https://imglib.shoplazza.com/Aland.png",
"iso_code_2": "AX",
"iso_code_3": "ALA",
"name": "Aland lslands",
"phone_code": "358",
"phone_key": "AX_358"
},
{
"cn_name": "津巴布韦",
"flag": "https://imglib.shoplazza.com/eb2d7eafed41ce90f19b6b94055291a7.png",
"iso_code_2": "ZW",
"iso_code_3": "ZWE",
"name": "Zimbabwe",
"phone_code": "263",
"phone_key": "ZW_263"
}
]
List the currencies the platform supports
GET /{locale}/api/currency
Get currency-related information data.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/currency')
.then((response) => response.json())
.then((data) => {
// Do something...
});
Response
- Schema
- Example
- Array [
- ]
Chinese name of the currency.
Currency code, for example USD.
Currency ID.
URL of the flag image.
Symbol shown to the left of the amount.
Symbol shown to the right of the amount.
Display name of the currency in the storefront language.
[
{
"cn_name": "美元",
"code": "USD",
"currency_id": 1,
"flag": "//img.staticdj.com/411902f97f55701c425aeb0b1df78fed.png",
"symbol_left": "$",
"symbol_right": "",
"title": "United States Dollars (USD)",
"value": 0
},
{
"cn_name": "欧元",
"code": "EUR",
"currency_id": 2,
"flag": "//img.staticdj.com/8e76e4a274e105aaeca38a9e00f76821.png",
"symbol_left": "€",
"symbol_right": "",
"title": "Euro (EUR)",
"value": 0
},
{
"cn_name": "伊朗里亚尔",
"code": "IRR",
"currency_id": 152,
"flag": "//img.staticdj.com/df0e6a9526632c7f50447e2d28d7766e.png",
"symbol_left": "",
"symbol_right": "﷼",
"title": "Iranian Rial (IRR)",
"value": 0
}
]
List countries and regions
GET /{locale}/api/country
Get country-related information data.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/country')
.then((response) => response.json())
.then((data) => {
// Do something...
});
Response
- Schema
- Example
- Array [
- ]
Chinese name of the country.
Continent the country belongs to.
Country ID.
URL of the flag image.
ISO 3166-1 alpha-2 country code.
ISO 3166-1 alpha-3 country code.
English name of the country.
International dialling code of the country.
[
{
"cn_name": "阿富汗",
"continent": "AS",
"country_id": 1,
"flag": "https://imglib.shoplazza.com/42757bc371af7061a1775697529b55c6.png",
"iso_code_2": "AF",
"iso_code_3": "AFG",
"name": "Afghanistan",
"phone_code": "93"
},
{
"cn_name": "奥兰群岛",
"continent": "EU",
"country_id": 2,
"flag": "https://imglib.shoplazza.com/Aland.png",
"iso_code_2": "AX",
"iso_code_3": "ALA",
"name": "Aland lslands",
"phone_code": "358"
},
{
"cn_name": "津巴布韦",
"continent": "AF",
"country_id": 240,
"flag": "https://imglib.shoplazza.com/eb2d7eafed41ce90f19b6b94055291a7.png",
"iso_code_2": "ZW",
"iso_code_3": "ZWE",
"name": "Zimbabwe",
"phone_code": "263"
}
]
List the provinces of a country or region
GET /{locale}/api/country/{country_code}/province
Get province-related information data from country code Alpha-2.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/country/CN/province')
.then((response) => response.json())
.then((data) => {
// Do something...
});
Request parameters
Two-letter country code, such as CN.
Response
- Schema
- Example
- Array [
- ]
Chinese name of the province.
Code of the province.
Code of the country the province belongs to.
English name of the province.
Legacy code of the province.
Province ID.
[
{
"cn_name": "安徽省",
"code": "CN-AH",
"country_code2": "CN",
"name": "Anhui",
"old_code": "ANH",
"province_id": 615
},
{
"cn_name": "北京市",
"code": "CN-BJ",
"country_code2": "CN",
"name": "Beijing",
"old_code": "BJG",
"province_id": 616
},
{
"cn_name": "浙江省",
"code": "CN-ZJ",
"country_code2": "CN",
"name": "Zhejiang",
"old_code": "ZHE",
"province_id": 648
}
]
Get the visitor's IP address and country
GET /{locale}/api/ip-info
Get the IP address of the visitor and the country it resolves to. Takes no parameters.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/ip-info')
.then((response) => response.json())
.then((data) => {
// Do something...
});
Response
- Schema
- Example
Two-letter country code resolved from the visitor's IP address.
The visitor's IP address.
{
"country": "US",
"ip": "203.0.113.10"
}
List the currencies the store has enabled
GET /{locale}/api/multi-currency/finance-list
Get the currencies the store has enabled and the default currency among them. Takes no parameters.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/multi-currency/finance-list')
.then((response) => response.json())
.then((data) => {
// do something...
});
Response
The example is trimmed to three currencies.
- Schema
- Example
- Array [
- ]
Request result flag; success or 0 means the request succeeded.
Result message returned with the response.
data object
The response payload.
Code of the store's default currency.
list object[]
Currencies enabled for the store.
Currency code, for example USD.
Display name of the currency in the storefront language.
English name of the currency.
Currency symbol.
URL of the flag image.
Whether this is the default currency; 1 yes, 0 no.
Where the currency symbol is placed, left or right.
{
"state": 0,
"msg": "请求成功",
"data": {
"default_code": "USD",
"open_state": 1,
"list": [
{
"code": "USD",
"title": "美元(USD)",
"name": "United States Dollars (USD)",
"symbol": "$",
"flag": "//img.staticdj.com/411902f97f55701c425aeb0b1df78fed.png",
"default": 1,
"format": "amount",
"currency_symbol_pos": "left",
"finance": 1
},
{
"code": "CNY",
"title": "中国人民币(CNY)",
"name": "Chinese Yuan Renminbi (CNY)",
"symbol": "¥",
"flag": "//img.staticdj.com/8990b1b7cab189e38913017d3887b918.png",
"default": 0,
"format": "amount",
"currency_symbol_pos": "left",
"finance": 6.71915
},
{
"code": "JPY",
"title": "日元(JPY)",
"name": "Japanese Yen (JPY)",
"symbol": "¥",
"flag": "//img.staticdj.com/e2393bdde2c379e21d71ffbe77cc2739.png",
"default": 0,
"format": "amount",
"currency_symbol_pos": "left",
"finance": 155.872505
}
]
}
}
List the coupons a customer can claim for a product
GET /{locale}/api/discount-code/coupons
Get the coupons a customer can claim for one product.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/discount-code/coupons?product_id=14a309ec-b966-4cf9-a9bb-33baa821fdbc')
.then((response) => response.json())
.then((data) => {
// do something...
});
Request parameters
The id of the product.
Response
The store used here runs no coupon campaign, so the list in the example is empty.
- Schema
- Example
The response payload.
{
"data": []
}
Get the language pack of a theme
GET /{locale}/api/front/themes/languages
Get the language pack of a theme: the translated strings the storefront renders, grouped into catalogues.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/front/themes/languages?catalogues=all&theme_id=1709a232-7dc7-4412-9209-be8baf14b66f')
.then((response) => response.json())
.then((data) => {
// do something...
});
Request parameters
The catalogues to return. Pass all to get every catalogue.
The id of the theme.
Response
The example below leaves out most of the translation keys.
- Schema
- Example
data object
The response payload.
config object
Storefront translation entries, grouped by section.
bag object
Translation entries for the shopping bag.
blog object
Translation entries for the blog.
cart object
Translation entries for the cart.
Language code of the returned content, for example en-US.
Result message returned with the response.
Request result flag; success or 0 means the request succeeded.
{
"data": {
"config": {
"bag": {},
"blog": {},
"cart": {}
},
"language": "en-US"
},
"msg": "请求成功",
"state": 0
}