PUT 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 .
metafieldDefinitionEdit
Request Headers
  • Content-Type required
    The value of this field is fixed to application/json; charset=utf-8
  • Authorization string required
    The 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
    Metafields definition
  • accessobject
    Access settings that apply to each metafield that belongs to the metafield definition.
  • admin string
    Admin access settings for metafields under this definition, supports: PRIVATE, MERCHANT_READ, MERCHANT_READ_WRITE, PUBLIC_READ
    Example: MERCHANT_READ
  • description string
    A description of the metafield definition.
    Example: This is the description for the "new" Product Care Guidelines metafield
  • key string required
    A 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
    Define human-readable metafield names.
    Example: Product Care Guide
  • namespace string required
    A metafield defines a container for a set of metafields that will be associated. Must be 3-50 characters in length and only supports alphanumeric, hyphen, and underscore characters.
    1. If you need to set app permissions, the namespace format is: $app:{app-name}
    2. If $app:{app-name} is not added, it is a common metafield definition. Even if access is entered, this access will not take effect.
    Example: $app:testapp
  • owner_resource string required
    The meta field defines the resource object type to attach to: products, customers, orders, pages, variants, collections articles, blogs, draft_orders, smart_collections locations, images, shop
    Example: products
Response
For more information about status codes, see Http status code.

Response Headers
  • traceId
    traceId
Response Body
  • definitionobject
    Metafields definition
  • accessobject
    Access settings that apply to each metafield that belongs to the metafield definition.
  • admin string
    Admin access settings for metafields under this definition, supports: PRIVATE, MERCHANT_READ, MERCHANT_READ_WRITE,PUBLIC_READ
    Example: MERCHANT_READ
  • created_at string
    The creation time of the meta field definition.
    Example: 2023-05-26T10:11:26+08:00
  • description string
    A description of the metafield definition.
    Example: This is the description for the "new" Product Care Guidelines metafield
  • id long
    The definition ID of the metafield.
    Example: 71213507083
  • key string
    Must be 3-30 characters in length and only supports alphanumeric, hyphen, and underscore characters.
    Example: product-guide
  • name string
    Define human-readable metafield names.
    Example: Product Care Guide
  • namespace string
    A 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.
    1. If the input parameter is $app:{app-name}, the output will parse the app id in the format: {app}--{your-app-id}--{some-namespace}
    2. 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 string
    The meta field defines the resource object type to attach to: products, customers, orders, pages, variants, collections articles, blogs, draft_orders, smart_collections locations, images, shop
    Example: products
  • type string
    The 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 string
    The last update time of the meta field definition.
    Example: 2023-05-26T10:11:26+08:00
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20250601

ParamOptions

header required

Body

required
{
  "definition": {
    "access": {
      "admin": "MERCHANT_READ"
    },
    "description": "This is the description for the \"new\" Product Care Guidelines metafield",
    "key": "product-guide",
    "name": "Product Care Guide",
    "namespace": "$app:testapp",
    "owner_resource": "products"
  }
}

Language

curl --request PUT \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20250601/metafield_definition.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json' \
--data '
{
"definition": {
"access": {
"admin": "MERCHANT_READ"
},
"description": "This is the description for the \"new\" Product Care Guidelines metafield",
"key": "product-guide",
"name": "Product Care Guide",
"namespace": "$app:testapp",
"owner_resource": "products"
}
}
'
Examples
Failed: The metafield definition does not exist
Request
{
"definition": {
"access": {},
"key": "product-guide3",
"namespace": "test123",
"owner_resource": "products"
}
}
Response
{}
Was this article helpful to you?

Error loading component.

Error loading component.