Create Metafield

POST https://api.ecartapi.com/api/v2/metafields

Please note that all Metafield Definitions you create through our metafields resource will have the access type of MERCHANTREADWRITE. For more information, visit this link.

Make sure that your integration has the readcontent and writecontent access scopes to be able to create Metafield Definitions.

Properties

PropertiesDescription
nameThe human-readable name for the metafield definition.
namespaceThe container for a group of metafields that the metafield definition will be associated with.
Must be 3-255 characters long and only contain alphanumeric, hyphen, and underscore characters.
keyThe unique identifier for the metafield definition within its namespace.

Must be 3-64 characters long and only contain alphanumeric, hyphen, and underscore characters.
descriptionThe description for the metafield definition.
typeThe type of data that each of the metafields that belong to the metafield definition will store. Refer to the list of supported types.
ownerTypeThe resource type that the metafield definition is attached to.

Request Body

{"metafield"=>{"name"=>"special note", "namespace"=>"orderControl", "key"=>"testing", "description"=>"metafield test for order resource", "type"=>"multi_line_text_field", "ownerType"=>"order"}}

HEADERS

KeyDatatypeRequiredDescription
Authorizationstring

RESPONSES

status: OK

{"success":true,"metafield":{"id":"34854240425","description":"metafield test for order resource","key":"testing","name":"special note","ownerType":null,"namespace":"app--9176940545--orderControl","type":null}}