Skip to main content
Version: 202201

Create Metafield

POST 

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

Request

Path Parameters

    resource stringrequired

    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 stringrequired

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

Body

    definition_idstringrequired

    Specify definition id for creating meta fields

    namespacestringrequired

    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.

    keystringrequired

    The key of the metafield.

    valuestringrequired

    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 } }

    typestringrequired

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

    descriptionstring

    A description of the information that the metafield contains.

Responses

200

Schema
    metafield object
    idstring
    Example: 374087540346466346
    store_idinteger
    Default value: 0
    Example: 633130
    created_atstring
    Example: 2024-04-28T06:52:36.101927450Z
    updated_atstring
    Example: 2024-04-28T06:52:36.101927568Z
    owner_resourcestring
    Example: product
    owner_idstring
    Example: a1a88be0-a1d4-47e4-a2f2-ba6e131cf447
    namespacestring
    Example: shirt
    keystring
    Example: weight1
    typestring
    Example: weight
    valuestring
    Example: 10
    descriptionstring
    Example: weight
    definition_idstring
    Example: 374087760941687850