跳转到内容
安装应用
简体中文

[GET] 设置

AI 概览

介绍返回店铺应用设置的只读端点,包括时区、日期格式、店面文本以及预购和即将上市的显示选项。

  • 无需参数,调用 GET /shop-api/settings;速率限制为 throttle:60,1。
  • 设置只能通过 API 读取;请在应用后台中更改。
  • timezone、date_format 和 translation 只需任意有效令牌;preorder 和 coming_soon 分组需要相应的读取权限范围,否则会被省略。
  • use_selling_plan 表示店铺使用的模式:true 为 Shopify 销售方案模式,false 为旧版模式。
  • translation.default 始终存在;其他语言环境可能只包含已翻译的键,因此请回退到 default。

摘要由 AI 生成,可能有误,请以下方完整指南为准。

[GET] 设置

* 身份验证

必需 Authorization

限制 throttle:60,1

端点 GET - /shop-api/settings

只读。店铺设置只能通过 Shop API 读取,需在应用后台中修改。

请求头

请求头 是否必需 说明
Authorization 是 店铺公共 API 密钥 Bearer token
Content-Type 是 application/json

范围

任何有效的 API 令牌都可以调用此端点。返回哪些分组取决于令牌的权限范围;令牌无权读取的分组不会出现在响应中。

分组 所需范围
timezone, date_format, translation 无(任何有效令牌)
preorder read_preorders(或 write_preorders)
coming_soon read_coming_soon(或 write_coming_soon)

1. 请求负载

无参数,无 JSON 请求体。

示例

GET /shop-api/settings
Authorization: Bearer token ************

2. 成功响应 200

具有 read_preorders 和 read_coming_soon 权限的令牌(本示例中的 translation 已截断):

{
"success": true,
"data": {
"timezone": "America/New_York",
"date_format": "MMM DD, YYYY",
"translation": {
"default": {
"preorderText": "Pre Order",
"messageAboveText": "Don't miss out - Grab yours now before we sell out again!",
"messageBellowText": "We will fulfill the item as soon as it becomes available",
"preorderBadge": "Pre Order",
"preorderLabel": "Pre-order",
"comingSoonAddToCartText": "Coming soon",
"partialPaymentLabel": "Payment option",
"partialPaymentReleased": "You will be charged the remaining balance when the product is released on {{ released }}"
},
"fr": {
"preorderText": "Précommander",
"preorderBadge": "Précommande"
}
},
"preorder": {
"use_selling_plan": true,
"hide_buy_now_button": true,
"required_continue_selling": false,
"show_preorder_badge": true,
"show_preorder_label": true,
"show_payment_option_on_collection": true,
"show_messages_on_collection": false
},
"coming_soon": {
"show_coming_soon_badge": false,
"show_messages_on_collection": false
}
}
}

3. 响应键和字段

顶层

键 类型 说明
success boolean 成功时为 true
data object 店铺设置对象

data 设置对象

字段 类型 说明
timezone string 店铺的 IANA 时区,例如 America/New_York。通过 Shop API 创建的优惠使用此时区作为 start_date / end_date
date_format string 应用中设置的日期显示格式,使用 Moment.js 风格的标记,例如 MMM DD, YYYY、DD/MM/YYYY。默认为 MMM DD, YYYY
translation object 各语言的店面文本。请参阅下方的 translation
preorder object 预购设置。仅限具有 read_preorders 权限的令牌
coming_soon object 即将上市设置。仅限具有 read_coming_soon 权限的令牌

preorder

字段 类型 说明
use_selling_plan boolean 店铺的预购模式:true = Shopify 销售方案模式,false = 旧版模式
hide_buy_now_button boolean 对预购产品隐藏“Buy now”按钮(产品页面和快速查看窗口)
required_continue_selling boolean 仅当产品启用了“缺货时继续销售”时才显示预购
show_preorder_badge boolean 在产品列表中显示预购徽章。当前套餐不包含徽章时始终为 false
show_preorder_label boolean 显示预购标签
show_payment_option_on_collection boolean 在产品系列页面上显示付款选项(全额付款 / 部分付款)
show_messages_on_collection boolean 在产品系列页面上显示促销消息和配送说明(按钮上方 / 下方的消息)

coming_soon

字段 类型 说明
show_coming_soon_badge boolean 在产品列表中显示即将上市徽章
show_messages_on_collection boolean 在产品系列页面上显示按钮上方 / 下方的即将上市消息

translation

键 类型 说明
default object 店铺默认语言的文本。始终存在;店铺从未自定义的键使用应用默认值填充
<locale> object 其他语言的文本,以语言代码(例如 fr)为键。可能只包含已翻译的键——缺失的键请回退到 default

文本可能包含 HTML 和占位符,例如 :stock、:max、{{product.title}}、{{variant.title}}、{{ released }}。

翻译键(今后可能会增加更多键):

分组 键
预购按钮和消息 preorderText, messageAboveText, messageBellowText, naMessageText, soldoutText, comingSoonText, preorderLimitMessage, outOfStockMessage, preorderLabel
倒计时 labelCountdownStart, labelCountdownEnd, labelCountdownComingsoon, labelCountdownDays, labelCountdownHours, labelCountdownMinutes, labelCountdownSeconds
即将上市 comingSoonAddToCartText, messageComingSoonAboveText, messageComingSoonBellowText
徽章 preorderBadge, comingSoonPreorderBadge, comingSoonAtcBadge
付款 partialPaymentLabel, partialPaymentOptionFull, partialPaymentOptionPart, preorderPrice, partialPaymentTitle, partialPaymentReleased, partialPaymentSaveLavel
购物车 preorderedItemlabel, preorderContactLink, cartWarningTitle, cartWarningContent, cartWarningCheckboxLabel, cartWarningLimitMessage, cartWarningEndLimitMessage, cartWarningAlertMessage
到货提醒 bisTextButton, bisTitleForm, bisHeaderContent, bisPlaceHolderEmail, bisSubscribeTextButton, bisFooterContent, bisSubscribeSuccess, bisSubscribeFail, bisSubscribeRegistered, bisSubscribeRequired, bisPhoneRegistered, bisEmailAlertTitle, bisSmsAlertTitle
退订 unsubscribeTitle, unsubscribeButton, unsubscribeSuccess, unsubscribeProductUnsubscribed

4. 失败响应

缺少令牌 — 401

{"success": false,"message": "Missing API token"}

令牌无效或已被撤销 — 401

{"success": false,"message": "Invalid or revoked API token"}

请求过多 — 429

意外的服务器错误 — HTTP 200

{"success": false,"message": "Something went wrong, please try again"}

此页面对您有帮助吗?

报告问题