上下文
店铺上下文包含可用语言和销售市场的信息。获取上下文后,你可以查看各自的代码和标识符、默认语言及基础市场。之后的请求需要选择语言或市场时,可以使用这些信息。
- languages
- 商店可用的语言及其代码。
- markets
- 销售市场及其标识符和货币。
- default_locale
- 商店默认语言代码。
- base_market_id
- 商店基础市场的标识符。
获取 · 上下文
此请求需要访问令牌。
GET
/api/v1/contextcURL 请求
curl --disable --globoff --fail-with-body --silent --show-error \
--proto '=https' --connect-timeout 5 --max-time 30 \
--request GET \
--url https://shop.onshopently.com/api/v1/context \
--header 'Authorization: Bearer EXAMPLE_ACCESS_TOKEN'
响应
{
"data": {
"base_market_id": "example",
"default_locale": "en",
"global_enabled": false,
"languages": [
{
"code": "en",
"direction": "ltr",
"is_default": true,
"name": "English",
"native_name": "English",
"status": "draft"
}
],
"markets": [
{
"code": "PL",
"currency": {
"code": "PLN",
"minor_units": 2
},
"id": "example",
"is_default": true,
"name": "Poland",
"price_list": null,
"status": "draft"
}
],
"multilingual_enabled": false
},
"meta": {
"locale": "en",
"market_code": "PL",
"market_id": "example",
"request_id": "example"
}
}
选择语言
获取店铺内容时,请选择希望使用的语言。语言代码可在上下文请求的响应中找到。
语言和市场需要分别选择。选择德语并不会自动选择德国市场。