Global Fields
A Global field is a reusable field (or group of fields) that you can define once and reuse across multiple content types within your stack. This eliminates the need to recreate the same set of fields multiple times, saving effort and ensuring consistency.
You can pass the branch header in API requests to fetch or manage modules within specific branches of the stack. Additionally, setting the include_branch query parameter to true includes the _branch key in the response, specifying the unique ID of the branch where the module resides.
Additional Resource: You can create dynamic and flexible Global Fields by nesting Global fields within a Modular Block,Global, or a Group fields.
Get all global fields
https://cdn.contentstack.io/v3/global_fieldsThe Get all global fields request returns comprehensive information of all the global fields available in a particular stack in your organization. If you have nested global fields, it appears in the response.
- Information about Global fields can be retrieved by all users, regardless of their role or access level.
- If your Global field contains nested Global fields, they will appear as part of the schema in the API response.
{
"global_fields": [
{
"created_at": "2019-09-06T11:30:02.108Z",
"updated_at": "2019-09-06T11:30:02.108Z",
"title": "Servlet",
"uid": "servlet",
"_version": 1,
"inbuilt_class": false,
"schema": [
{
"display_name": "Name",
"uid": "name",
"data_type": "text",
"multiple": false,
"mandatory": false,
"unique": false,
"non_localizable": false
},
{
"data_type": "text",
"display_name": "Rich text editor",
"uid": "description",
"field_metadata": {
"allow_rich_text": true,
"description": "",
"multiline": false,
"rich_text_type": "advanced",
"options": [],
"version": 3
},
"multiple": false,
"mandatory": false,
"unique": false,
"non_localizable": false
}
],
"last_activity": {},
"maintain_revisions": true,
"description": ""
}
]
}Get a single global field
https://cdn.contentstack.io/v3/global_fields/{global_field_uid}The Get a single global field request allows you to fetch comprehensive details of a specific global field.
When executing the API call, in the 'URL Parameters' section, provide the unique ID of your global field.
- Information about Global fields can be retrieved by all users, regardless of their role or access level.
- If your Global field contains nested Global fields, they will appear as part of the schema in the API response.
{
"global_field": {
"created_at": "2019-09-06T11:30:02.108Z",
"updated_at": "2019-09-06T11:30:02.108Z",
"title": "Servlet",
"uid": "servlet",
"_version": 1,
"inbuilt_class": false,
"schema": [
{
"display_name": "Name",
"uid": "name",
"data_type": "text",
"multiple": false,
"mandatory": false,
"unique": false,
"non_localizable": false
},
{
"data_type": "text",
"display_name": "Rich text editor",
"uid": "description",
"field_metadata": {
"allow_rich_text": true,
"description": "",
"multiline": false,
"rich_text_type": "advanced",
"options": [],
"version": 3
},
"multiple": false,
"mandatory": false,
"unique": false,
"non_localizable": false
}
],
"last_activity": {},
"maintain_revisions": true,
"description": ""
}
}