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"
}
]
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
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"
}
1
2
3
4
5
6
7
2
3
4
5
6
7
Update
Parameters
Note
value_type
supports these types
Response
json
{
"status": 200,
"detail": "",
"meta": []
}
1
2
3
4
5
2
3
4
5
Delete
By ID
Response
json
{
"message": "The resource has been successfully deleted.",
"type": "success"
}
1
2
3
4
2
3
4
By namespace and key
Response
json
{
"message": "The resource has been successfully deleted.",
"type": "success"
}
1
2
3
4
2
3
4
Show
By ID
Response
json
{
"id": "2YcCVBRMqjpRcqFbeN9fpUAWmQc",
"namespace": "reviews-app",
"key": "rating",
"value": "4",
"type": "number"
}
1
2
3
4
5
6
7
2
3
4
5
6
7
By namespace and key
Response
json
{
"id": "2YcCVBRMqjpRcqFbeN9fpUAWmQc",
"namespace": "reviews-app",
"key": "rating",
"value": "4",
"type": "number"
}
1
2
3
4
5
6
7
2
3
4
5
6
7