Skip to main content

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

Example request using Fetch
fetch(window.SHOPLAZZA.routes.root + '/api/phone')
.then((response) => response.json())
.then((data) => {
// Do something...
});

Response

  • Array [
  • cn_namestring

    Chinese name of the country.

    flagstring

    URL of the flag image.

    iso_code_2string

    ISO 3166-1 alpha-2 country code.

    iso_code_3string

    ISO 3166-1 alpha-3 country code.

    namestring

    English name of the country.

    phone_codestring

    International dialling code of the country.

    phone_keystring

    Key combining the country code and the dialling code, for example AF_93.

  • ]

List the currencies the platform supports

GET /{locale}/api/currency

Get currency-related information data.

Example request

Example request using Fetch
fetch(window.SHOPLAZZA.routes.root + '/api/currency')
.then((response) => response.json())
.then((data) => {
// Do something...
});

Response

  • Array [
  • cn_namestring

    Chinese name of the currency.

    codestring

    Currency code, for example USD.

    currency_idnumber

    Currency ID.

    flagstring

    URL of the flag image.

    symbol_leftstring

    Symbol shown to the left of the amount.

    symbol_rightstring

    Symbol shown to the right of the amount.

    titlestring

    Display name of the currency in the storefront language.

    valuenumber
  • ]

List countries and regions

GET /{locale}/api/country

Get country-related information data.

Example request

Example request using Fetch
fetch(window.SHOPLAZZA.routes.root + '/api/country')
.then((response) => response.json())
.then((data) => {
// Do something...
});

Response

  • Array [
  • cn_namestring

    Chinese name of the country.

    continentstring

    Continent the country belongs to.

    country_idnumber

    Country ID.

    flagstring

    URL of the flag image.

    iso_code_2string

    ISO 3166-1 alpha-2 country code.

    iso_code_3string

    ISO 3166-1 alpha-3 country code.

    namestring

    English name of the country.

    phone_codestring

    International dialling code of the country.

  • ]

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

Example request using Fetch
fetch(window.SHOPLAZZA.routes.root + '/api/country/CN/province')
.then((response) => response.json())
.then((data) => {
// Do something...
});

Request parameters

    country_codestring

    Two-letter country code, such as CN.

Response

  • Array [
  • cn_namestring

    Chinese name of the province.

    codestring

    Code of the province.

    country_code2string

    Code of the country the province belongs to.

    namestring

    English name of the province.

    old_codestring

    Legacy code of the province.

    province_idnumber

    Province ID.

  • ]

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

Example request using Fetch
fetch(window.SHOPLAZZA.routes.root + '/api/ip-info')
.then((response) => response.json())
.then((data) => {
// Do something...
});

Response

    countrystring

    Two-letter country code resolved from the visitor's IP address.

    ipstring

    The visitor's IP address.

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

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.

    statenumber

    Request result flag; success or 0 means the request succeeded.

    msgstring

    Result message returned with the response.

    data object

    The response payload.

    default_codestring

    Code of the store's default currency.

    open_statenumber
    list object[]

    Currencies enabled for the store.

  • Array [
  • codestring

    Currency code, for example USD.

    titlestring

    Display name of the currency in the storefront language.

    namestring

    English name of the currency.

    symbolstring

    Currency symbol.

    flagstring

    URL of the flag image.

    defaultnumber

    Whether this is the default currency; 1 yes, 0 no.

    formatstring
    currency_symbol_posstring

    Where the currency symbol is placed, left or right.

    financenumber
  • ]

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

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

    product_idstring

    The id of the product.

Response

The store used here runs no coupon campaign, so the list in the example is empty.

    dataundefined[]

    The response payload.

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

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

    cataloguesstring

    The catalogues to return. Pass all to get every catalogue.

    theme_idstring

    The id of the theme.

Response

The example below leaves out most of the translation keys.

    data object

    The response payload.

    config object

    Storefront translation entries, grouped by section.

    bag object

    Translation entries for the shopping bag.

    object
    blog object

    Translation entries for the blog.

    object
    cart object

    Translation entries for the cart.

    object
    languagestring

    Language code of the returned content, for example en-US.

    msgstring

    Result message returned with the response.

    statenumber

    Request result flag; success or 0 means the request succeeded.