Skip to content

CRUD

Metafield management is available through the admin API. Developers are able to create/update/delete/list metafields and have them available in liquid files and API.

List

Response

json
[
    {
        "id": "2YcBCnAFyyDjLv0wuhZdFnWIqjR",
        "namespace": "reviews-app",
        "key": "rating",
        "value": "4",
        "type": "number"
    }
]

Create

Parameters

Note

value_type supports these types

Some scenarios to consider when creating a new metafield.

  • If the namespace and key already exists, and the existing value is not a list, we override the value.
  • If the namespace and key already exists, the existing value is a list, and the coming value is single, we append the value to the list.
  • If the namespace and key already exists, the existing value is a list, and the coming value is a list, we override the value.

Response

json
{
    "id": "2YcBCnAFyyDjLv0wuhZdFnWIqjR",
    "namespace": "reviews-app",
    "key": "rating",
    "value": "4",
    "type": "number"
}

Update

Parameters

Note

value_type supports these types

Response

json
{
    "status": 200,
    "detail": "",
    "meta": []
}

Delete

By ID

Response

json
{
    "message": "The resource has been successfully deleted.",
    "type": "success"
}

By namespace and key

Response

json
{
    "message": "The resource has been successfully deleted.",
    "type": "success"
}

Show

By ID

Response

json
{
    "id": "2YcCVBRMqjpRcqFbeN9fpUAWmQc",
    "namespace": "reviews-app",
    "key": "rating",
    "value": "4",
    "type": "number"
}

By namespace and key

Response

json
{
    "id": "2YcCVBRMqjpRcqFbeN9fpUAWmQc",
    "namespace": "reviews-app",
    "key": "rating",
    "value": "4",
    "type": "number"
}