Global Field Query
Global Field Query
A Global field is a reusable field or group of fields that you define once and reuse across any content type in your stack. This helps you avoid recreating the same set of fields multiple times, saving time and effort.
find
The find method retrieves all Global Fields from your stack using a Global Field query, providing access to the complete collection of Global Field data.
Example:
using Contentstack.Core;
using Contentstack.Core.Configuration;
var options = new ContentstackOptions()
{
ApiKey = "your_api_key",
DeliveryToken = "your_delivery_token",
Environment = "your_environment"
};
ContentstackClient stack = new ContentstackClient(options);
GlobalFieldQuery query = stack.GlobalFieldQuery();
var result = await query.Find();
Console.WriteLine(result.ToString());IncludeGlobalFieldSchema
The IncludeGlobalFieldSchema method includes the complete schema for each Global Field when fetching all Global Fields using a query.
Example:
using Contentstack.Core;
using Contentstack.Core.Configuration;
var options = new ContentstackOptions()
{
ApiKey = "your_api_key",
DeliveryToken = "your_delivery_token",
Environment = "your_environment"
};
ContentstackClient stack = new ContentstackClient(options);
var result = await stack.GlobalFieldQuery()
.IncludeGlobalFieldSchema()
.Find();