Metafield Definition Count

Retrieve the count of specific metafield definitions for a given resource.

This API is especially useful for:

  1. Calculating the total count of metafield definitions for a resource.
  2. Verifying metafield definitions exist for provided IDs.
  3. Managing metafield limits for resources efficiently.

Note: The operation is scoped to a specific shop, identified by its unique domain prefix (shopdomain), ensuring all queries are applied to the correct store.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Path Parameters

FieldTypeRequiredExampleDescription
owner_resourcestringYesproductThe type of resource that the metafield is attached to. Available resources: shop, product, product_image, product_variant, order, page, customer, collection, blog, article.

Query Parameters

FieldTypeRequiredExampleDescription
definition_idsarray of stringYes["374034306256875562", "374032579801653802"]Array of metafield definition IDs to count.

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Successful Response

FieldTypeExampleDescription
itemsarray of objectList of metafield count results.
items[].metafield_countinteger0Total count of metafields for the definition.
items[].definition_idstring374034306256875562ID of the metafield definition.

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["invalid own resources"]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
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
422"invalid own resources"empty own resources or invalid resources"invalid own resources"

API Structure Overview

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