GlobalField
GlobalField
You can define a Global Field as a reusable field (or a group of fields) that you define once and use in any content type within your stack.
Note To enable nested global fields, pass api_version: 3.2 when initializing the Global Field object.
Create
The Create global field with JSON RTE request shows you how to add a JSON RTE field while creating a global field.
| Name | Type | Description |
|---|---|---|
| model (required) | ContentModelling | Content Model for updating GlobalField. |
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentModeling model = new ContentModeling();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").GlobalField().Create(model);CreateAsync
The Create global field with JSON RTE request shows you how to add a JSON RTE field while creating a global field.
| Name | Type | Description |
|---|---|---|
| model (required) | ContentModelling | Content Model for updating GlobalField. |
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentModeling model = new ContentModeling();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").GlobalField().CreateAsync(model);Delete
The Delete Content Type call deletes an existing global field and all the entries within it.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").GlobalField("<GLOBAL_FIELD_UID>").Delete();DeleteAsync
The Delete Content Type call deletes an existing global field and all the entries within it.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").GlobalField("<GLOBAL_FIELD_UID>").DeleteAsync();Fetch
The Fetch a single global fieldcall returns information of a specific global field.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").GlobalField("<GLOBAL_FIELD_UID>").Fetch();FetchAsync
The Fetch a single global fieldcall returns information of a specific global field.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").GlobalField("<GLOBAL_FIELD_UID>").FetchAsync();Query
The Query on Global Field will allow to fetch details of all or specific Content Type.
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
Query query = client.Stack("<API_KEY>").GlobalField().Query();Update
The Update Content Type call is used to update the schema of an existing global field.
| Name | Type | Description |
|---|---|---|
| model (required) | ContentModelling | Content Model for updating GlobalField. |
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentModeling model = new ContentModeling();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").GlobalField("<GLOBAL_FIELD_UID>").Update(model);UpdateAsync
The Update Content Type call is used to update the schema of an existing global field.
| Name | Type | Description |
|---|---|---|
| model (required) | ContentModelling | Content Model for updating GlobalField. |
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentModeling model = new ContentModeling();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").GlobalField("<GLOBAL_FIELD_UID>").UpdateAsync(model);