patch https://{shopdomain}.myshoplaza.com/openapi/2022-01///metafields/
The Update Metafield API updates the data stored in an existing metafield for a specific resource.
This API is especially useful for:
- Modifying the value of metafields attached to a resource.
- Updating metafield types or descriptions to maintain data consistency.
- Managing dynamic resource data across supported resources.
Request Parameters
Public Request Parameters
Path Parameters
Field | Type | Required | Example | Description |
---|---|---|---|---|
resource | string | Yes | product | The type of resource that the metafield is attached to. Available resources include: shop , product , product_image , product_variant , order , page , customer , collection , blog , article . |
resource_id | string | Yes | a1a88be0-a1d4-47e4 | The unique ID of the resource that the metafield is attached to. |
id | string | Yes | 374087540346466346 | The unique ID of the metafield to be updated. |
Body Parameters
Field | Type | Required | Example | Description |
---|---|---|---|---|
value | string | Yes | 20 | The data to store in the metafield. |
type | string | Yes | weight | The type of data that the metafield stores. Supported types include: date , weight , json , etc. |
description | string | No | Updated weight info | A description of the information that the metafield contains. |
Response Explanation
Public Response Parameters
Successful Response
Field | Type | Example | Description |
---|---|---|---|
metafield | object | Metafield object containing all metafield details. | |
metafield.id | string | 374087540346466346 | Unique identifier for the metafield. |
metafield.store_id | integer | 633130 | Store ID associated with the metafield. |
metafield.created_at | string | 2024-04-28T06:52:36.101927450Z | Creation timestamp in UTC. |
metafield.updated_at | string | 2024-04-28T06:52:36.101927568Z | Last update timestamp in UTC. |
metafield.owner_resource | string | product | The resource type the metafield is attached to. |
metafield.owner_id | string | a1a88be0-a1d4-47e4-a2f2-ba6e131cf447 | ID of the resource to which the metafield is attached. |
metafield.namespace | string | shirt | Namespace to group the metafield. |
metafield.key | string | weight1 | Key to identify the metafield. |
metafield.type | string | weight | Type of data stored in the metafield. |
metafield.value | string | 10 | Value stored in the metafield. |
metafield.description | string | weight | Brief description of the metafield. |
metafield.definition_id | string | 374087760941687850 | ID of the metafield definition used. |
Error Response
Error responses in the API can be represented using two different fields: errors
and error
. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field | Type | Example | Description |
---|---|---|---|
errors | array | ["data not found"] | A list of errors encountered during the request processing. |
Field | Type | Example | Description |
---|---|---|---|
error | String | "store is not active" | Indicates an error encountered during the process |
Error Detail
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
type should not be empty invalid key value type value should not be empty | type should not be empty invalid key value type value should not be empty | ||
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized | |
404 | No metafield found |