Create Metafield
POST/openapi/2022-01/:resource/:resource_id/metafields
Request
Path Parameters
The type of resource that the metafield is attached to. Available resources: shop, product, product_image, product_variant, order, page, customer, collection, blog, article.
The unique ID of the resource that the metafield is attached to.
- application/json
- Body
- Example
Body
Specify definition id for creating meta fields
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.
The key of the metafield.
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 } }
The type of data that the metafield stores in the value field.
A description of the information that the metafield contains.
{
"definition_id": "string",
"namespace": "string",
"key": "string",
"value": "string",
"type": "string",
"description": "string"
}
Responses
- 200
- 400
200
- application/json
- Schema
- Example
- Result
Schema
metafield object
37408754034646634606331302024-04-28T06:52:36.101927450Z2024-04-28T06:52:36.101927568Zproducta1a88be0-a1d4-47e4-a2f2-ba6e131cf447shirtweight1weight10weight374087760941687850{
"metafield": {
"id": "374087540346466346",
"store_id": 633130,
"created_at": "2024-04-28T06:52:36.101927450Z",
"updated_at": "2024-04-28T06:52:36.101927568Z",
"owner_resource": "product",
"owner_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
"namespace": "shirt",
"key": "weight1",
"type": "weight",
"value": "10",
"description": "weight",
"definition_id": "374087760941687850"
}
}
{
"metafield": {
"id": "374087540346466346",
"store_id": 633130,
"created_at": "2024-04-28T06:52:36.101927450Z",
"updated_at": "2024-04-28T06:52:36.101927568Z",
"owner_resource": "product",
"owner_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
"namespace": "shirt",
"key": "weight1",
"type": "weight",
"value": "10",
"description": "weight",
"definition_id": "374087760941687850"
}
}
400
- text/plain