Update Matefield

The Update Metafield API updates the data stored in an existing metafield for a specific resource.

This API is especially useful for:

  1. Modifying the value of metafields attached to a resource.
  2. Updating metafield types or descriptions to maintain data consistency.
  3. Managing dynamic resource data across supported resources.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Path Parameters

FieldTypeRequiredExampleDescription
resourcestringYesproductThe 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_idstringYesa1a88be0-a1d4-47e4The unique ID of the resource that the metafield is attached to.
idstringYes374087540346466346The unique ID of the metafield to be updated.

Body Parameters

FieldTypeRequiredExampleDescription
valuestringYes20The data to store in the metafield.
typestringYesweightThe type of data that the metafield stores. Supported types include: date, weight, json, etc.
descriptionstringNoUpdated weight infoA description of the information that the metafield contains.

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Successful Response

FieldTypeExampleDescription
metafieldobjectMetafield object containing all metafield details.
metafield.idstring374087540346466346Unique identifier for the metafield.
metafield.store_idinteger633130Store ID associated with the metafield.
metafield.created_atstring2024-04-28T06:52:36.101927450ZCreation timestamp in UTC.
metafield.updated_atstring2024-04-28T06:52:36.101927568ZLast update timestamp in UTC.
metafield.owner_resourcestringproductThe resource type the metafield is attached to.
metafield.owner_idstringa1a88be0-a1d4-47e4-a2f2-ba6e131cf447ID of the resource to which the metafield is attached.
metafield.namespacestringshirtNamespace to group the metafield.
metafield.keystringweight1Key to identify the metafield.
metafield.typestringweightType of data stored in the metafield.
metafield.valuestring10Value stored in the metafield.
metafield.descriptionstringweightBrief description of the metafield.
metafield.definition_idstring374087760941687850ID 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.

FieldTypeExampleDescription
errorsarray["data not found"]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorString "store is not active"Indicates an error encountered during the process

Error Detail

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid 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
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
404No metafield found

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!