Skip to content

About Metafield

Access scope

Multiple access scopes needed — refer to each endpoint for access scope requirements.

Meta Fields is a fundamental service component of the Genstore platform, providing flexible business metadata management capabilities. Through the Meta Fields service, business systems can achieve dynamic field extension and data value management, ensuring business model scalability.

Core Functions

  • Meta Field Definition Management: Enable creation, update, deletion and query of meta fields, supporting field model extension across business domains.
  • Metadata Value Management: Provide metadata access, update and batch processing capabilities, ensuring business data consistency.

Use Cases

  • Dynamic Field Extension: Business teams can add new properties to existing models through meta field definitions, enabling rapid business model iteration.
  • Flexible Data Management: Operations teams can configure and manage various business tags and properties, improving business data management efficiency.

Metafield Object

The product object.

Properties

metafieldobjectrequired
- Hide child properties
definitionNamestringrequired
The name of the meta field.
descriptionstringrequired
Description of the meta field.
namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.
codestringrequired
The meta field uniquely identified and is unique in the same namespace.
fieldTypestringrequired
Meta field type. Different types of meta fields store metadata in different formats. Enumeration value:
* SingleLineText - single line text;
* MultiLineText - multiple lines of text;
* Integer - an integer;
* Decimal - decimal;
* MonthDay - month day;
* Date - Date, which is in ISO 8601 format and does not include a time zone.
* DateTime - Date and time, supporting date values in ISO 8601 format and time values in UTC time.
* Weight - weight;
* Size - the size;
* Volume - volume;
* Product - a product;
* Customer - a customer;
* SKU - Product specifications;
* Collection - a collection of goods;
* Page - page; File - file;
* Color - a color;
* Money - the amount of money;
* Url-url;
* Boolean - True or False.
multibooleanrequired
Whether the meta-field supports multi-value lists. The meta-field control that supports multi-value lists allows users to enter multiple items. The meta-field data is stored in JSON Array format.
schemaRuleobject
The meta field verification rule can limit the length and range of metadata input. If the value is empty, it indicates that the meta field is not verified. Check rules for different fields are different. For details, refer to the field Rules document.
optionMapobject
The meta-field extension configuration is used to store the extension information defined by the business on the field, such as whether to support search. The specific configuration is stored in Map format. The Map key is determined by the business provider during definition.
bash
{
  "metafield": {
    "definitionName": "MyFieldName01",
    "code": "MyFieldCode1",
    "namespace": "AppleName",
    "description": "this is meta field description sample",
    "optionMap": "{"search":true}",
    "fieldType": "Weight",
    "multi": "false",
    "schemaRule": "{"min":{"value":2,"unit":"g"},"max":{"value":200,"unit":"kg"}}"
  }
}

POST Create metafield value

Create metafield values in batch.

Access scope

Requires ANY of the following access scopes: write_metafields

Endpoint

POST /api/202412/metafields/{domainName}/{bizId} 

Request Params

metaFieldDataListarrayrequired
Data list, you can batch set multiple metafield value at a time.
- Hide child properties
codestringrequired
The meta field uniquely identified and is unique in the same namespace.
valuestringrequired
The value of metadata.
namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.

Response Data

metafieldobjectrequired
- Hide child properties
metaFieldDataListarrayrequired
Data list, batch set multiple meta field data.
+ Show child properties
bash
curl -X POST \ 
https://{shop}.genmystore.com/api/202412/metafields/{domainName}/{bizId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"metaFieldDataList":[
		{
			"code":"MyFieldCode1",
			"namespace":"AppleName",
			"value":"{\"value\": 9,\"unit\": \"kg\"}"
		}
	]
}'
json
HTTP/1.1 200 OK
{
  "metafield": {
    "metaFieldDataList": [
      {
        "code": "MyFieldCode1",
        "namespace": "AppleName",
        "value": "{\"value\": 9,\"unit\": \"kg\"}"
      }
    ]
  }
}

PUT Update metafield value

Update metafield value.

Access scope

Requires ANY of the following access scopes: write_metafields

Endpoint

PUT /api/202412/metafields/{domainName}/{bizId} 

Request Params

metaFieldDataobjectrequired
- Hide child properties
namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.
codestringrequired
The meta field uniquely identified and is unique in the same namespace.
valuestringrequired
The value of metadata.

Response Data

metafieldobjectrequired
- Hide child properties
namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.
codestringrequired
The meta field uniquely identified and is unique in the same namespace.
valuestringrequired
The value of metadata.
bash
curl -X PUT \ 
https://{shop}.genmystore.com/api/202412/metafields/{domainName}/{bizId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"metaFieldData":{
		"code":"MyFieldKey01",
		"namespace":"AppleName",
		"value":"{\"value\": 9,\"unit\": \"kg\"}"
	}
}'
json
HTTP/1.1 200 OK
{
  "metafield": {
    "code": "MyFieldCode1",
    "namespace": "AppleName",
    "value": "{\"value\": 9,\"unit\": \"kg\"}"
  }
}

DELETE Delete metafield value

Delete metafield value.

Access scope

Requires ANY of the following access scopes: write_metafields

Endpoint

DELETE /api/202412/metafields/{domainName}/{bizId} 

Request Params

namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.
codestringrequired
The meta field uniquely identified and is unique in the same namespace.
valuestringrequired
The value of metadata.

Response Data

metafieldsobjectrequired
- Hide child properties
namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.
codestringrequired
The meta field uniquely identified and is unique in the same namespace.
valuestringrequired
The value of metadata.
bash
curl -X DELETE \ 
https://{shop}.genmystore.com/api/202412/metafields/{domainName}/{bizId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "metafields": {
    "code": "MyFieldCode1",
    "namespace": "AppleName",
    "value": "{\"value\": 9,\"unit\": \"kg\"}"
  }
}

GET Get metafield value count

Get metafield value count.

Access scope

Requires ANY of the following access scopes: read_metafields

Endpoint

GET /api/202412/metafields/count/{domainName}/{bizId} 

Request Params

{}

Response Data

countnumberrequired
The amount of metadata for the object.
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/metafields/count/{domainName}/{bizId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "count": "999"
}

GET Get metafield value details

Get metafield value detail.

Access scope

Requires ANY of the following access scopes: read_metafields

Endpoint

GET /api/202412/metafields/detail/{domainName}/{bizId} 

Request Params

namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces
codestringrequired
The unique code of the metafield in the namespace

Response Data

metafieldobjectrequired
List.
- Hide child properties
namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces
codestringrequired
The unique code of the meta field in the namespace
descriptionstringrequired
Description of the metamaterial field
valuestringrequired
Meta data content
fieldTypestringrequired
Meta field type. Different types of meta fields store metadata in different formats. Enumeration value:
* SingleLineText - single line text;
* MultiLineText - multiple lines of text;
* Integer - an integer;
* Decimal - decimal;
* MonthDay - month day;
* Date - Date, which is in ISO 8601 format and does not include a time zone.
* DateTime - Date and time, supporting date values in ISO 8601 format and time values in UTC time.
* Weight - weight;
* Size - the size;
* Volume - volume;
* Product - a product;
* Customer - a customer;
* SKU - Product specifications;
* Collection - a collection of goods;
* Page - page; File - file;
* Color - a color;
* Money - the amount of money;
* Url-url;
* Boolean - True or False.
definitionNamestringrequired
The name of the meta field.
bizIdstringrequired
Owning resource id
bizResourcestringrequired
Owning resource field type
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/metafields/detail/{domainName}/{bizId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "metafield": {
    "code": "MyFieldKey01",
    "definitionName": "MyFieldShowName",
    "namespace": "ProductA01",
    "bizId": "102744460756584",
    "description": "This is my field description",
    "value": "hello",
    "fieldType": "SingleLineText",
    "bizResource": "SingleLineText/Integer/Weight/Customer"
  }
}

GET Get metafield values

Get list of metafield values.

Access scope

Requires ANY of the following access scopes: read_metafields

Endpoint

GET /api/202412/metafields/{domainName}/{bizId} 

Request Params

namespacestring
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.
codesstring
The unique code of the meta field in the namespace., If multiple queries are to be queried, separate them using commas (,).
fieldTypestring
Meta field type. Different types of meta fields store metadata in different formats. Enumeration value:
* SingleLineText - single line text;
* MultiLineText - multiple lines of text;
* Integer - an integer;
* Decimal - decimal;
* MonthDay - month day;
* Date - Date, which is in ISO 8601 format and does not include a time zone.
* DateTime - Date and time, supporting date values in ISO 8601 format and time values in UTC time.
* Weight - weight;
* Size - the size;
* Volume - volume;
* Product - a product;
* Customer - a customer;
* SKU - Product specifications;
* Collection - a collection of goods;
* Page - page; File - file;
* Color - a color;
* Money - the amount of money;
* Url-url;
* Boolean - True or False.
limitnumberrequired
The maximum number of results to show.
pageTokenstring
A unique ID used to access a certain page of results. The page_info parameter can't be modified and must be used exactly as it appears in the link header URL.

Response Data

metafieldsarrayrequired
Metafield value list.
- Hide child properties
namespacestringrequired
The business can uniquely identify the field code based on the field isolation namespace. The same field code can be created in different namespaces.
codestringrequired
The unique code of the meta field in the namespace.
descriptionstringrequired
Description of the metamaterial field.
valuestringrequired
Meta data content.
fieldTypestringrequired
Meta field type. Different types of meta fields store metadata in different formats. Enumeration value:
* SingleLineText - single line text;
* MultiLineText - multiple lines of text;
* Integer - an integer;
* Decimal - decimal;
* MonthDay - month day;
* Date - Date, which is in ISO 8601 format and does not include a time zone.
* DateTime - Date and time, supporting date values in ISO 8601 format and time values in UTC time.
* Weight - weight;
* Size - the size;
* Volume - volume;
* Product - a product;
* Customer - a customer;
* SKU - Product specifications;
* Collection - a collection of goods;
* Page - page; File - file;
* Color - a color;
* Money - the amount of money;
* Url-url;
* Boolean - True or False.
definitionNamestringrequired
The name of the meta field.
bizIdstringrequired
id of the business to which the resource belongs.
bizResourcestringrequired
Meta field type to which the resource belongs.
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/metafields/{domainName}/{bizId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "metafields": [
    {
      "code": "MyFieldKey01",
      "definitionName": "MyFieldShowName",
      "namespace": "ProductA01",
      "bizId": "102744460756584",
      "description": "This is my field description",
      "value": "hello",
      "fieldType": "SingleLineText",
      "bizResource": "SingleLineText"
    }
  ]
}