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

metafieldobject
- Hide child properties
definitionNamestring
The name of the meta field.
descriptionstring
Description of the meta field.
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.
codestring
The meta field uniquely identified and is unique in the same namespace.
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.
multiboolean
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

listarray
Data list, you can batch set multiple metafield value at a time.
- Hide child properties
codestring
The meta field uniquely identified and is unique in the same namespace.
valuestring
The value of metadata.
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.

Response Data

metafieldsobject
- Hide child properties
listarray
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 '{
	"list":[
		{
			"code":"MyFieldCode1",
			"namespace":"AppleName",
			"value":"{\"value\": 9,\"unit\": \"kg\"}"
		}
	]
}'
json
HTTP/1.1 200 OK
{
  "metafields": {
    "list": [
      {
        "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

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.
codestring
The meta field uniquely identified and is unique in the same namespace.
valuestring
The value of metadata.

Response Data

metafieldsobject
- Hide child properties
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.
codestring
The meta field uniquely identified and is unique in the same namespace.
valuestring
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 '{
	"code":"MyFieldKey01",
	"namespace":"AppleName",
	"value":"{\"value\": 9,\"unit\": \"kg\"}"
}'
json
HTTP/1.1 200 OK
{
  "metafields": {
    "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

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.
codestring
The meta field uniquely identified and is unique in the same namespace.
valuestring
The value of metadata.

Response Data

metafieldsobject
- Hide child properties
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.
codestring
The meta field uniquely identified and is unique in the same namespace.
valuestring
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 write_metafields

Endpoint

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

Request Params

{}

Response Data

countnumber
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 write_metafields

Endpoint

GET /api/202412/metafields/detail/{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
codestring
The unique code of the metafield in the namespace

Response Data

metafieldobject
List.
- Hide child properties
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
codestring
The unique code of the meta field in the namespace
descriptionstring
Description of the metamaterial field
valuestring
Meta data content
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.
definitionNamestring
The name of the meta field.
bizIdstring
Owning resource id
bizResourcestring
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 write_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.
limitnumber
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

metafieldsarray
Metafield value list.
- Hide child properties
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.
codestring
The unique code of the meta field in the namespace.
descriptionstring
Description of the metamaterial field.
valuestring
Meta data content.
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.
definitionNamestring
The name of the meta field.
bizIdstring
id of the business to which the resource belongs.
bizResourcestring
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"
    }
  ]
}