Storeware Docs
REST

Metafields

The typed fields a shop and its apps keep on records.

List metafield definitions

GET /api/v1/stores/{storeId}/metafield-definitions

Every field the shop records, by kind of record and then position, the shop’s own and those its apps declare.

Needs stores:read.

Parameters

ParameterInTypeDescription
storeIdpathstringThe shop.
ownerTypequerystringOnly the fields for this kind of record. Any other value is a 400. One of product, variant, collection, customer, order, store.

Answers 200

FieldTypeDescription
dataarray of MetafieldDefinition
curl "https://api.storeware.ai/api/v1/stores/$STORE_ID/metafield-definitions" \
  -H "Authorization: Bearer $TOKEN"

Get a metafield definition

GET /api/v1/stores/{storeId}/metafield-definitions/{definitionId}

Needs stores:read.

Parameters

ParameterInTypeDescription
storeIdpathstringThe shop.
definitionIdpathstringThe definition.

Answers 200

FieldTypeDescription
dataMetafieldDefinition
curl "https://api.storeware.ai/api/v1/stores/$STORE_ID/metafield-definitions/$DEFINITION_ID" \
  -H "Authorization: Bearer $TOKEN"

Update a metafield definition

PATCH /api/v1/stores/{storeId}/metafield-definitions/{definitionId}

Changes only the fields sent. The namespace, key, type and list flag cannot change. An app may change only the fields its manifest declared; any other answers 403 metafield_definition_not_yours.

Needs stores:write.

Parameters

ParameterInTypeDescription
storeIdpathstringThe shop.
definitionIdpathstringThe definition.

Body

FieldTypeRequiredDescription
namestringNo1 to 200 characters.
descriptionstring or nullNoUp to 2,000 characters.
validationsobjectNoDefault {}.
validations.minnumberNo
validations.maxnumberNo
validations.minLengthintegerNoAt least 0.
validations.maxLengthintegerNoAt least 1.
validations.choicesarray of stringNoUp to 100 items.
validations.scaleintegerNoFrom 0 to 8.
storefrontVisiblebooleanNo
searchFacetbooleanNo
positionintegerNoAt least 0.

Answers 200

FieldTypeDescription
dataMetafieldDefinition
curl -X PATCH "https://api.storeware.ai/api/v1/stores/$STORE_ID/metafield-definitions/$DEFINITION_ID" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d @body.json

Delete a metafield definition

DELETE /api/v1/stores/{storeId}/metafield-definitions/{definitionId}

Refused while any record holds a value for it, unless withValues=1 is sent, which deletes every value with it. An app may delete only the fields its manifest declared; any other answers 403 metafield_definition_not_yours.

Needs stores:write.

Parameters

ParameterInTypeDescription
storeIdpathstringThe shop.
definitionIdpathstringThe definition.
withValuesquerystring1 deletes the field’s values too. One of 1.

Answers 200

FieldTypeDescription
dataobject
data.deletedValuesintegerHow many values went with it.
curl -X DELETE "https://api.storeware.ai/api/v1/stores/$STORE_ID/metafield-definitions/$DEFINITION_ID" \
  -H "Authorization: Bearer $TOKEN"

List the shop’s metafields

GET /api/v1/stores/{storeId}/metafields

Every metafield value set on the shop, each with its definition.

Needs stores:read.

Parameters

ParameterInTypeDescription
storeIdpathstringThe shop.

Answers 200

FieldTypeDescription
dataarray of object
data[].definitionIdstring (uuid)
data[].namespacestring
data[].keystring
data[].labelstringThe merchant’s name for the field.
data[].typestringsingle_line_text, multi_line_text, integer, decimal, boolean, date, url and the other definition types.
data[].isListboolean
data[].storefrontVisibleboolean
data[].searchFacetboolean
data[].positioninteger
data[].valueanyThe value, or a list of values when isList.
data[].displayValuestringThe value as one line of text, lists joined.
data[].sourcestringWho set it: the merchant, an import, or an app’s slug.
curl "https://api.storeware.ai/api/v1/stores/$STORE_ID/metafields" \
  -H "Authorization: Bearer $TOKEN"

Set the shop’s metafields

PUT /api/v1/stores/{storeId}/metafields

Sets up to 25 values in one call. A null value clears its field; keys not named are left alone. An app may set only the fields its manifest declares.

Needs stores:write.

Parameters

ParameterInTypeDescription
storeIdpathstringThe shop.

Body

FieldTypeRequiredDescription
metafieldsarray of objectYesUp to 25 items. At least 1 item.
metafields[].namespacestringNoDefault custom.
metafields[].keystringYes
metafields[].valueanyNo

Answers 200

FieldTypeDescription
dataarray of object
data[].definitionIdstring (uuid)
data[].namespacestring
data[].keystring
data[].labelstringThe merchant’s name for the field.
data[].typestringsingle_line_text, multi_line_text, integer, decimal, boolean, date, url and the other definition types.
data[].isListboolean
data[].storefrontVisibleboolean
data[].searchFacetboolean
data[].positioninteger
data[].valueanyThe value, or a list of values when isList.
data[].displayValuestringThe value as one line of text, lists joined.
data[].sourcestringWho set it: the merchant, an import, or an app’s slug.
curl -X PUT "https://api.storeware.ai/api/v1/stores/$STORE_ID/metafields" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d @body.json

On this page