Create Metafield Definition
POST https://{handle}.myshopline.com/admin/openapi/v20250601/metafield_definition.json
handle
: The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is open001.myshopline.com
, the store handle is open001
.metafieldDefinitionCreate
Request Headers
- Content-Type requiredThe value of this field is fixed to
application/json; charset=utf-8
- Authorization string requiredThe access token for the API. Please refer to App authorization to obtain the access token, and then put the obtained access token into the API request header in Bearer Token.Example:
Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
Request Body
definitionobject required
Metafield definitionaccessobject
Access settings that apply to each metafield that belongs to the metafield definition.admin stringAdmin access settings for metafields under this definition, supports: PRIVATE, MERCHANT_READ, MERCHANT_READ_WRITEExample:MERCHANT_READ
description stringA description of the metafield definition.Example:This is the description for the Product Care Guidelines metafield
key string requiredA metafield is defined as a unique identifier within its namespace. Must be 3-30 characters in length and only supports alphanumeric, hyphen, and underscore characters.Example:product-guide
name string requiredDefine human-readable metafield names.Example:Product Care Guide
namespace string requiredA metafield defines a container for a set of metafields that will be related. Must be 2-50 characters long, and only alphanumeric, hyphen, and underscore characters are supported.- If app permissions need to be set, the namespace format is: $app:{app-name}
- If you do not add $app:{app-name}, it is defined as an ordinary meta field, even if access is entered, this access will not take effect
Example:$app:testapp
owner_resource string requiredThe meta field defines the resource object type to attach to: products, customers, orders, pages, variants, collections articles, blogs, draft_orders, smart_collections locations, images, shopExample:products
type string requiredThe type of data that each metafield that belongs to the metafield definition will store. See the list of supported types.Example:multi_line_text_field
Response
- 200
- 400
- 401
- 429
- 500
For more information about status codes, see Http status code.
Response Headers
traceId
traceId
Response Body
definitionobject
definitionaccessobject
Access settings that apply to each metafield that belongs to the metafield definition.admin stringAdmin access settings for metafields under this definition, supports: PRIVATE, MERCHANT_READ, MERCHANT_READ_WRITEExample:MERCHANT_READ
created_at stringThe creation time of the meta field definition.Example:2023-05-26T10:11:26+08:00
description stringA description of the metafield definition.Example:This is the description for the Product Care Guidelines meta field
id stringThe definition ID of the metafield.Example:71213507083
key stringA metafield is defined as a unique identifier within its namespace. Must be 3-30 characters in length and only supports alphanumeric, hyphen, and underscore characters.Example:product-guide
name stringDefine human-readable metafield names.Example:Product Care Guide
namespace stringA metafield defines a container for a set of metafields that will be associated. Must be 2-50 characters in length and only supports alphanumeric, hyphen, and underscore characters.- If the input parameter is $app:{app-name}, the output will parse the app id in the format: {app}--{your-app-id}--{some-namespace}
- If the input parameter is not $app:{app-name}, the output will be the original namespace.
Example:app--70303--riven or my_fields
owner_resource stringThe meta field defines the resource object type to attach to: products, customers, orders, pages, variants, collections articles, blogs, draft_orders, smart_collections locations, images, shopExample:products
type stringThe type of data that each metafield that belongs to the metafield definition will store. See the list of supported types.Example:multi_line_text_field
updated_at stringThe last update time of the meta field definition.Example:2023-05-26T10:11:26+08:00
API Explorer
Debugger
Examples
Was this article helpful to you?