younifyd
Menu

metafieldDefinitions

Query metafield definitions — supports a search `query`, `sortKey`, and cursor paging.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the metafieldDefinitions action (under Metafield).
  3. Fill in the fields below, then reference the result from later steps as {{metafielddefinitions.response.data}}.

Query

This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
query MetafieldDefinitions($key: String, $namespace: String, $ownerType: MetafieldOwnerType!, $pinnedStatus: MetafieldDefinitionPinnedStatus, $constraintSubtype: MetafieldDefinitionConstraintSubtypeIdentifier, $constraintStatus: MetafieldDefinitionConstraintStatus, $first: Int, $after: String, $last: Int, $before: String, $reverse: Boolean, $sortKey: MetafieldDefinitionSortKeys, $query: String) {
  metafieldDefinitions(
    key: $key
    namespace: $namespace
    ownerType: $ownerType
    pinnedStatus: $pinnedStatus
    constraintSubtype: $constraintSubtype
    constraintStatus: $constraintStatus
    first: $first
    after: $after
    last: $last
    before: $before
    reverse: $reverse
    sortKey: $sortKey
    query: $query
  ) {
    edges {
      cursor
      node {
        access
        capabilities
        constraints
        description
        id
        key
        name
        namespace
        ownerType
        pinnedPosition
        standardTemplate
        type
        useAsCollectionCondition
        validationStatus
        validations
      }
    }
    nodes {
      access {
        admin
        customerAccount
        storefront
      }
      capabilities {
        adminFilterable
        analyticsQueryable
        cartToOrderCopyable
        smartCollectionCondition
        uniqueValues
      }
      constraints {
        key
      }
      description
      id
      key
      name
      namespace
      ownerType
      pinnedPosition
      standardTemplate {
        description
        id
        key
        name
        namespace
        ownerTypes
        type
        validations
        visibleToStorefrontApi
      }
      type {
        category
        name
        supportedValidations
        supportsDefinitionMigrations
        valueType
      }
      useAsCollectionCondition
      validationStatus
      validations {
        name
        type
        value
      }
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

keystring

Filter metafield definition by key.

namespacestring

Filter metafield definition by namespace.

ownerTypestringrequired

Filter the metafield definition by the specific owner type.

One ofAPI_PERMISSIONCOMPANYCOMPANY_LOCATIONPAYMENT_CUSTOMIZATIONVALIDATIONCUSTOMERDELIVERY_CUSTOMIZATIONDRAFTORDERGIFT_CARD_TRANSACTIONTRANSFERMARKETCARTTRANSFORMCOLLECTIONMEDIA_IMAGEPRODUCTPRODUCTVARIANTSELLING_PLANARTICLEBLOGPAGEFULFILLMENT_CONSTRAINT_RULEORDER_ROUTING_LOCATION_RULEDISCOUNTORDERLOCATIONSHOP

pinnedStatusstring

Filter the metafield definition by the pinned status.

One ofANYPINNEDUNPINNED

constraintSubtypeobject

Filter metafield definitions based on whether they apply to a given resource subtype.

keystringrequired
valuestringrequired
constraintStatusstring

Filter metafield definitions based on whether they are constrained.

One ofCONSTRAINED_AND_UNCONSTRAINEDCONSTRAINED_ONLYUNCONSTRAINED_ONLY

firstnumber

The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

afterstring

The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

lastnumber

The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

beforestring

The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

reverseboolean

Reverse the order of the underlying list.

sortKeystring

Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations).

One ofIDNAMEPINNED_POSITIONRELEVANCE

querystring

A filter made up of terms, connectives, modifiers, and comparators. | name | type | description | acceptable_values | default_value | example_use | | ---- | ---- | ---- | ---- | ---- | ---- | | default | string | Filter by a case-insensitive search of multiple fields in a document. | | | - `query=Bob Norman`<br/> - `query=title:green hoodie` | | created_at | time | Filter by the date and time when the metafield definition was created. | | | - `created_at:>'2020-10-21T23:39:20Z'`<br/> - `created_at:<now`<br/> - `created_at:<=2024` | | id | id | Filter by `id` range. | | | - `id:1234`<br/> - `id:>=1234`<br/> - `id:<=1234` | | key | string | Filter by the metafield definition [`key`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-key) field. | | | - `key:some-key` | | namespace | string | Filter by the metafield definition [`namespace`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-namespace) field. | | | - `namespace:some-namespace` | | owner_type | string | Filter by the metafield definition [`ownerType`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-ownertype) field. | | | - `owner_type:PRODUCT` | | type | string | Filter by the metafield definition [`type`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-type) field. | | | - `type:single_line_text_field` | | updated_at | time | Filter by the date and time when the metafield definition was last updated. | | | - `updated_at:>'2020-10-21T23:39:20Z'`<br/> - `updated_at:<now`<br/> - `updated_at:<=2024` | You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).

json
{
  "ownerType": "API_PERMISSION",
  "key": "string",
  "namespace": "string",
  "pinnedStatus": "ANY",
  "constraintSubtype": {
    "key": "string",
    "value": "string"
  },
  "constraintStatus": "CONSTRAINED_AND_UNCONSTRAINED",
  "first": 0,
  "after": "string",
  "last": 0,
  "before": "string",
  "reverse": false,
  "sortKey": "ID"
}

Response

Read the result with {{metafielddefinitions.response.data.data.metafieldDefinitions}}. If the API returns errors, the step fails and they are at {{metafielddefinitions.response.data.errors}}.

edgesarray<object>
cursorobject
nodeobject
nodesarray<object>
accessobject
capabilitiesobject
constraintsobject
descriptionobject
idobject
keyobject
nameobject
namespaceobject
ownerTypeobject
pinnedPositionobject
standardTemplateobject
typeobject
useAsCollectionConditionobject
validationStatusobject
validationsobject
pageInfoobject
endCursorstring
hasNextPageboolean
hasPreviousPageboolean
startCursorstring

Need more? See the Shopify guide for connection setup and behaviour shared by every action.