The Locale API
The Locale API can be used with a GET request to either retrieve the list of locale languages that are available in the current environment or look up the description of a language based on its IETF (Internet Engineering Task Force) code. Only these two types of GET calls are supported by the API – there is no POST request actually mapped to this API to create any new locales.
There are no parameters or necessary identifiers that need to be added to the request. The addition of a /?manufacturerID={id} or /?retailerID={id} parameter will be filtered out and ignored by the API.
Version | 2.0 |
Call | https://integration.shopatron.com/api/v2/locale |
Supported Formats | JSON |
HTTP Method | GET |
Schema | https://integration.shopatron.com/api/v2/schema/locale.json |
The .json address above can be used to access the schema within Postman. An example use of the Locale API follows below, or view the schema or the sample Postman collection.
Example
In this example, the collection of languages returned includes a few sample languages. This is based on how the environment was set up and which locales have been enabled in the configuration.
To retrieve only the description of a known IETF code, then the code is simply appended to the request URL as /{code}, such as /de-DE.
General Information
The response returns a collection of entries with two pieces of information each:
- Locale Code (an Internet Engineering Task Force code)
- Locale Description
Retrieving Available Locales
Making the below request with the standard endpoint and no parameters will return a list of the locales supported by the environment.
https://integration.shopatron.com/api/v2/locale
This is the full response returned by the API.
{
"collection": [
{
"localeIETF": "en-US",
"description": "US English"
},
{
"localeIETF": "fr-CA",
"description": "Canadian French"
},
{
"localeIETF": "en-GB",
"description": "British English"
},
{
"localeIETF": "de-DE",
"description": "German"
},
{
"localeIETF": "fr-FR",
"description": "French"
},
{
"localeIETF": "it-IT",
"description": "Italian"
},
{
"localeIETF": "sv-SE",
"description": "Swedish"
},
{
"localeIETF": "nb-NO",
"description": "Norwegian"
}
]
}
Retrieving a Specific Locale
This second call looks up only the description of a specific locale code.
https://integration.shopatron.com/api/v2/locale/fr-FR
This is the full response returned by the API.
{
"localeIETF": "fr-FR",
"description": "French"
}