Get Metafield
Retrieves the details of a single metafield.
HTTP Request
- URL:
/metafields/{id} - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope: None. Any valid access token can call this endpoint.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the metafield. |
cURL Example
curl --location '<BASE_URL>/metafields/6650c2a1f1d2e83a1b9c0d11' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The metafield was returned successfully.
- 400 Bad Request: The metafield ID is not valid.
Sample JSON Response
{
"success": true,
"data": {
"_id": "6650c2a1f1d2e83a1b9c0d11",
"fieldType": "product",
"label": "Country of Origin",
"description": "Country where the product is manufactured.",
"code": "country_of_origin",
"allowAdminUpdate": true,
"displayStorefront": true,
"displayAdmin": true,
"displayFilter": true,
"hasPredefinedValues": false,
"predefinedValues": [],
"valueType": "text",
"createdAt": "2024-05-24T08:12:17.402Z",
"updatedAt": "2024-05-24T08:12:17.402Z"
}
}
Response Details
Metafield Data
| Field | Type | Description |
|---|---|---|
_id | String | Unique identifier of the metafield. |
fieldType | String | Type of record the metafield belongs to. |
label | String | Display label. |
description | String | Description of the metafield. |
code | String | Code used to set and filter values. |
allowAdminUpdate | Boolean | Whether admins can edit the value. |
displayStorefront | Boolean | Whether the value is shown on the storefront. |
displayAdmin | Boolean | Whether the value is shown in the admin panel. |
displayFilter | Boolean | Whether the metafield is offered as a storefront filter. |
hasPredefinedValues | Boolean | Whether values are chosen from a fixed list. |
predefinedValues | Array | List of allowed values. |
valueType | String | Type of value. |
createdAt | String | Date and time the metafield was created (ISO 8601). |
updatedAt | String | Date and time the metafield was last updated (ISO 8601). |
Notes
- If no metafield matches the ID,
dataisnull.