Create a field
https://am-api.contentstack.com/api/fieldsThe Create a field request creates a custom metadata field in your organization. Associate it with one or more asset types afterwards to make it available on assets.
Every field requires title, uid, display_type, is_system, is_mandatory, is_multiple, and field_metadata.
Choose uid deliberately and treat it as permanent: it is the key you read and write in user_defined_fields on an asset. Use display_type to select the input: TEXT, GROUP, URL, MULTITEXT, SELECT, NUMBER, BOOLEAN, DATE, RADIO, or CHECKBOX. Values are case-sensitive, so text is rejected with 422.
Set is_mandatory to require a value before an asset can be saved, and is_multiple to accept more than one value, which turns the field into a list. Set is_system to false for fields you create, because it marks a Contentstack-managed field.
Use field_metadata for per-type configuration, such as validation rules or the options of a choice field, and child to nest fields under a group field so related values stay together.
Mandatory field accepting several values:
{
"display_type": "TEXT",
"field_metadata": {},
"is_mandatory": true,
"is_multiple": true,
"is_system": false,
"title": "Usage Rights",
"uid": "usage_rights"
}undefined
Group field with nested children:
{
"child": [
{
"display_type": "DATE",
"is_mandatory": true,
"title": "Expires On",
"uid": "expires_on"
}
],
"display_type": "GROUP",
"field_metadata": {},
"is_mandatory": false,
"is_multiple": false,
"is_system": false,
"title": "Licence",
"uid": "licence"
}undefined
{
"description": "Who shot the asset.",
"display_type": "TEXT",
"field_metadata": {},
"is_mandatory": false,
"is_multiple": false,
"is_system": false,
"title": "Photographer",
"uid": "photographer"
}{
"notice": "string",
"field": {
"uid": "string",
"title": "string",
"display_type": "string",
"asset_types_count": 0,
"is_system": true,
"is_mandatory": true,
"is_multiple": true,
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"updated_at": "2019-08-24T14:15:22Z",
"updated_by": "string"
},
"job_id": "string"
}Get all fields
https://am-api.contentstack.com/api/fieldsThe Get all fields request fetches a paginated list of all custom metadata fields in your organization.
{
"count": 0,
"relation": "string",
"fields": [
{
"uid": "string",
"title": "string",
"display_type": "string",
"asset_types_count": 0,
"is_system": true,
"is_mandatory": true,
"is_multiple": true,
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"updated_at": "2019-08-24T14:15:22Z",
"updated_by": "string"
}
]
}Update a field
https://am-api.contentstack.com/api/fields/{field_uid}The Update a field request updates the details of a specific custom metadata field, such as its title, description, or validation rules.
If the update removes a child from a group field, the request returns 202 with a job_id: a background job then removes the values of the removed child from existing assets.
{
"title": "string",
"description": "string",
"is_mandatory": true,
"display_type": "string",
"field_metadata": {
"default_value": null,
"instruction": "string",
"helper_text": "string",
"placeholder_text": "string",
"max_multiple_count": 1,
"multiple_value": true,
"min": 0,
"max": 0,
"format": "string",
"data_type": "string",
"hide_time": true,
"choices": [
{}
]
},
"child": [
{}
],
"asset_types": [
{}
]
}{
"notice": "string",
"field": {
"uid": "string",
"title": "string",
"display_type": "string",
"asset_types_count": 0,
"is_system": true,
"is_mandatory": true,
"is_multiple": true,
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"updated_at": "2019-08-24T14:15:22Z",
"updated_by": "string"
},
"job_id": "string"
}Get a field
https://am-api.contentstack.com/api/fields/{field_uid}The Get a field request fetches the details of a specific custom metadata field using its uid.
{
"field": {
"_id": "string",
"uid": "string",
"title": "string",
"display_type": "string",
"description": "string",
"field_metadata": {
"default_value": null,
"instruction": "string",
"helper_text": "string",
"placeholder_text": "string",
"max_multiple_count": 1,
"multiple_value": true,
"min": 0,
"max": 0,
"format": "string",
"data_type": "string",
"hide_time": true,
"choices": [
{}
]
},
"is_mandatory": true,
"is_multiple": true,
"is_system": true,
"child": [
{}
],
"path": [
{
"uid": "string",
"title": "string"
}
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"updated_at": "2019-08-24T14:15:22Z",
"updated_by": "string"
}
}Delete a field
https://am-api.contentstack.com/api/fields/{field_uid}The Delete a field request deletes a specific custom metadata field using its uid.
The request returns 202: the field is deleted, and a background job then removes its values from existing assets. The response includes the job's job_id. Until the job finishes, some assets may still return a value for the field.
{
"notice": "string",
"uid": "string",
"job_id": "string"
}