批量操作元字段
POST https://{handle}.myshopline.com/admin/openapi/v20250601/metafields_set.json
handle
:店铺的唯一标识符,值为店铺域名的前缀。例如,域名为 open001.myshopline.com
的店铺,其 handle
是 open001
。批量操作元字段。若元字段不存在,则直接新增;若存在,则根据输入值进行更新。
请求头
- Content-Type required字段值固定为
application/json; charset=utf-8
- Authorization string required资源的访问令牌。请参考 应用授权 获取访问令牌,然后将获取到的访问令牌以 Bearer 格式传入Example:
Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
请求体
metafieldsobject[]
元字段列表。
最大个数限制:25description string元字段的描述信息。
最大长度限制:255Example:This is the description for the Product Care Guidelines metafield
key string元字段定义在其namespace
下的唯一标识符。仅支持字母、数字、连字符和下划线字符。
最小长度限制:3
最大长度限制:30Example:product-guide
namespace string元字段的命名空间。通过命名空间可对元字段进行分组,避免具有相同健名的元字段发生冲突。通过key
和namespace
可以唯一确定元字段。
仅支持字母、数字、连字符和下划线字符。
最小长度限制:2
最大长度限制:50Example:my_fields
owner_id string元字段所归属的资源 ID。例如,商品 A 的 ID 是1605898661
,当对商品 A 新增元字段时,此时owner_id
是1605898661
。
最大长度限制:128Example:16058986610866520712462605
owner_resource string元字段所归属的资源类型。有效枚举值包含:products
:商品variants
:商品变体collections
:商品分类customers
:会员orders
:订单pages
:页面blogs
:博客集合articles
:博客
Example:products
type string元字段支持的数据类型,有效枚举值包含:single_line_text_field
:单个单行文本list.single_line_text_field
:多个单行文本multi_line_text_field
:多行文本color
:单个颜色list.color
:多个颜色date
:单个日期list.date
:多个日期date_time
:单个日期和时间。格式:ISO 8601。list.date_time
:多个日期和时间。格式:ISO 8601。url
:单个 URLlist.url
:多个 URLfile_reference
:单个文件,支持 10M 以内的 PDF 和图片文件,图片支持 JPG、JEPG、PNG 和 GIF 格式。list.file_reference
:多个文件,支持 10M 以内的 PDF 和图片文件,图片支持 JPG、JEPG、PNG 和 GIF 格式。json
:JSON 类型weight
:单个重量,带单位list.weight
:多个重量,带单位volume
:单个体积,带单位list.volume
:多个体积,带单位dimension
:单个尺寸,带单位list.dimension
:多个尺寸,带单位number_integer
:单个整数list.number_integer
:多个整数number_decimal
:单个小数list.number_decimal
:多个小数rating
:单个等级list.rating
:多个等级page_reference
:单个页面list.page_reference
:多个页面product_reference
:单个商品list.product_reference
:多个商品variant_reference
:单个商品变体list.variant_reference
:多个商品变体collection_reference
:单个商品分类list.collection_reference
:多个商品分类customer_reference
:单个客户list.customer_reference
:多个客户order_reference
:单个订单list.order_reference
:多个订单boolean
:布尔类型,有效值包括true
和false
。money
:资金,带币种单位
关于更多元字段信息,参考 元字段功能使用指南。Example:multi_line_text_field
value object存储在元字段中的数据。
无论你如何定义元字段的类型,SHOPLINE 均将其转换为字符串格式进行存储,转换后的字符串最大长度限制是 500000。Example:[object Object]
响应
- 200
- 401
- 429
更多状态码信息请参考 HTTP 状态码
响应头
traceId
traceId
响应体
fail_metafieldsobject[]
更新或新增失败的元字段数据。errors string更新或新增失败的错误描述。key string元字段定义在其namespace
下的唯一标识符。仅支持字母、数字、连字符和下划线字符。Example:product-guide
namespace string元字段的命名空间。Example:my_fields
owner_id string元字段所归属的资源 ID。Example:16058986610866520712462605
owner_resource string元字段所归属的资源类型。有效枚举值包含:products
:商品variants
:商品变体collections
:商品分类customers
:会员orders
:订单pages
:页面blogs
:博客集合articles
:博客
Example:products
metafieldsobject[]
更新成功的元字段数据。description string元字段的描述信息。Example:This is the description for the Product Care Guidelines metafield
id long元字段 ID。Example:3152668027083
key string元字段定义在其namespace
下的唯一标识符。仅支持字母、数字、连字符和下划线字符。Example:product-guide
namespace string元字段的命名空间。Example:my_fields
owner_id string元字段所归属的资源 ID。Example:16058986610866520712462605
owner_resource string元字段所归属的资源类型。有效枚举值包含:products
:商品variants
:商品变体collections
:商品分类customers
:会员orders
:订单pages
:页面blogs
:博客集合articles
:博客
Example:products
type string元字段支持的数据类型,有效枚举值包含:single_line_text_field
:单个单行文本list.single_line_text_field
:多个单行文本multi_line_text_field
:多行文本color
:单个颜色list.color
:多个颜色date
:单个日期list.date
:多个日期date_time
:单个日期和时间。格式:ISO 8601。list.date_time
:多个日期和时间。格式:ISO 8601。url
:单个 URLlist.url
:多个 URLfile_reference
:单个文件,支持 10M 以内的 PDF 和图片文件,图片支持 JPG、JEPG、PNG 和 GIF 格式。list.file_reference
:多个文件,支持 10M 以内的 PDF 和图片文件,图片支持 JPG、JEPG、PNG 和 GIF 格式。json
:JSON 类型weight
:单个重量,带单位list.weight
:多个重量,带单位volume
:单个体积,带单位list.volume
:多个体积,带单位dimension
:单个尺寸,带单位list.dimension
:多个尺寸,带单位number_integer
:单个整数list.number_integer
:多个整数number_decimal
:单个小数list.number_decimal
:多个小数rating
:单个等级list.rating
:多个等级page_reference
:单个页面list.page_reference
:多个页面product_reference
:单个商品list.product_reference
:多个商品variant_reference
:单个商品变体list.variant_reference
:多个商品变体collection_reference
:单个商品分类list.collection_reference
:多个商品分类customer_reference
:单个客户list.customer_reference
:多个客户order_reference
:单个订单list.order_reference
:多个订单boolean
:布尔类型,有效值包括true
和false
。money
:资金,带币种单位
关于更多元字段信息,参考 元字段功能使用指南。Example:multi_line_text_field
value string存储在元字段中的数据。Example:This is the metafields assignment content
API Explorer
调试台
示例代码
这篇文章对你有帮助吗?
Error loading component.