Version: 202201
Create Metafield Definition
POST/openapi/2022-01/metafield_definition/:owner_resource
Create a new metafield definition.
Request
Path Parameters
owner_resource stringrequired
Owner resource type of meta field definition,for example: product_variant | product | collection
- application/json
- Body
- Example
Body
namespacestringrequired
Namespace of definition
keystringrequired
Key of definition
typestringrequired
Definition field type, choose from date date_time weight volume dimension integer number_decimal file_reference single_line_text_field json multi_line_text_field color rating url boolean
namestringrequired
Name of definition
descriptionstring
Description of definition
{
"namespace": "string",
"key": "string",
"type": "string",
"name": "string",
"description": "string"
}
Responses
- 200
- 422
200
- application/json
- Schema
- Example
- Result
Schema
idstring
Example:
374034306256875562keystring
Example:
key2namestring
Example:
Bignamespacestring
Example:
testowner_resourcestring
Example:
producttypestring
Example:
booleandescriptionstring
Example:
booleancreate_atstring
Example:
2024-04-28T03:18:59Zupdated_atstring
Example:
2024-04-28T03:18:59Z{
"id": "374034306256875562",
"key": "key2",
"name": "Big",
"namespace": "test",
"owner_resource": "product",
"type": "boolean",
"description": "boolean",
"create_at": "2024-04-28T03:18:59Z",
"updated_at": "2024-04-28T03:18:59Z"
}
{
"id": "374034306256875562",
"key": "key2",
"name": "Big",
"namespace": "test",
"owner_resource": "product",
"type": "boolean",
"description": "boolean",
"create_at": "2024-04-28T03:18:59Z",
"updated_at": "2024-04-28T03:18:59Z"
}
422
- application/json
- Schema
- Example
- Result
Schema
errorsstring[]
{
"errors": [
"Key is required"
]
}
{
"errors": [
"Key is required",
"Type is required",
"Name is required",
"Type is invalid",
"Metafield definition namespace and key exist"
]
}