跳到主要内容
版本:202201

创建元字段

POST 

/openapi/2022-01/:resource/:resource_id/metafields

请求

Path参数

    resource string必填

    The type of resource that the metafield is attached to. Available resources: shop, product, product_image, product_variant, order, page, customer, collection, blog, article.

    resource_id string必填

    The unique ID of the resource that the metafield is attached to.

请求体

    definition_idstring必填

    Specify definition id for creating meta fields

    namespacestring必填

    A container for a group of metafields. Grouping metafields within a namespace prevents your metafields from conflicting with other metafields with the same key name.

    keystring必填

    The key of the metafield.

    valuestring必填

    The data to store in the metafield.eg:{ "mediaContentType": "IMAGE", "image": { "path": "6181b00da510ae8cf04673695cecf4c8.jpg", "alt": "", "width": 750, "height": 750, "aspect_ratio": 1, "src": "https://cdn.shoplazza.com/6181b00da510ae8cf04673695cecf4c8.jpg", "size": 775566 } }

    typestring必填

    The type of data that the metafield stores in the value field.

    descriptionstring

    A description of the information that the metafield contains.

响应

200

数据结构
    metafield object
    idstring
    示例: 374087540346466346
    store_idinteger
    默认值: 0
    示例: 633130
    created_atstring
    示例: 2024-04-28T06:52:36.101927450Z
    updated_atstring
    示例: 2024-04-28T06:52:36.101927568Z
    owner_resourcestring
    示例: product
    owner_idstring
    示例: a1a88be0-a1d4-47e4-a2f2-ba6e131cf447
    namespacestring
    示例: shirt
    keystring
    示例: weight1
    typestring
    示例: weight
    valuestring
    示例: 10
    descriptionstring
    示例: weight
    definition_idstring
    示例: 374087760941687850