Entry

View as Markdown

Entry

An initializer is responsible for creating Entry object.

NameTypeDescription
Metadata Dictionary<string, object>

Set key/value attributes of Metadata.

Object Dictionary<string, object>

Set key/value attributes of an current entry instance.

Tags object[]
Set array of Tags
Title string

Title of an entry

Uid string

This is Entry Uid of an entry.

GetContentType

Get contentType name.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

string contentType = stack.ContentType("content_Type_uid").Entry("entry_uid").GetContentType();

GetUid

Get entry uid

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

var uid = entry.GetUid();

GetTitle

Get entry title

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

var title = entry.GetTitle();

GetTags

Returns tags of this entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

var tags = entry.GetTags();

GetMetadata

Get metadata of entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

var metadata = entry.GetMetadata();

GetHTMLText

Get html text for markdown data type

NameTypeDescription
markdownKeystring

field_uid as key.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

var result = entry.GetHTMLText("markdownKey");

GetMultipleHTMLText

Get html text for markdown data type which is multiple true

NameTypeDescription
markdownKeystring

Field_uid as key.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

List<string> metadata = entry.GetMultipleHTMLText("markdown_field_uid");

GetCreateAt

Get value of creation time of entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

DateTime datetime = entry.GetCreateAt();

GetCreatedBy

Get uid who created this entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

string createdBy = entry.GetCreatedBy();

GetUpdateAt

Get value of updating time of entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

DateTime datetime = entry.GetUpdateAt();

GetUpdatedBy

Get uid who updated this entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

string updatedBy = entry.GetUpdatedBy();

GetDeletedAt

Get value of deleting time of entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

DateTime datetime = entry.GetDeletedAt();

GetDeletedBy

Get uid who created this entry.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

string deletedBy = entry.GetDeletedBy();

Get

Get object value for key.

NameTypeDescription
keyObject

Key to get value

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();

Object value = entry.Get("key");

SetCachePolicy

To set cache policy using Entry instance.

NameTypeDescription
cachePolicyCachePolicy

CachePolicy instance

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").SetCachePolicy(CachePolicy.NetworkElseCache).Fetch<Entry>();

SetHeader

To set headers for Contentstack rest calls.

NameTypeDescription
keystring

header name.

valuestring

header value against given header name.

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").SetHeader("custom_key", "custom_value").Fetch();

RemoveHeader

Remove header key.

NameTypeDescription
keystring

key to be remove from header

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").RemoveHeader("header_to_remove").Fetch();

SetLocale

Sets the locale.

NameTypeDescription
Localestring

Locale to fetch entry

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").SetLocale("en-us").Fetch<Entry>();

SetUid

Assigns a uid to current instance of an entry.

NameTypeDescription
uidstring

Uid for entry to fetch

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.Entry().SetUid("entry_uid").SetLocale("en-us").Fetch<Entry>();

SetTags

Assign a tag(s) for this Entry.

NameTypeDescription
tagsstring[]

Collection of tags.

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.Entry("entry_uid").SetTags(new List<string>() {

	"tag_1"

}).Fetch<Entry>();

IncludeReferenceContentTypeUID

This method also includes the content type UIDs of the referenced entries returned in the response.

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReferenceContentTypeUID().Fetch<Entry>();

IncludeReference

Add a constraint that requires a particular reference key details.

NameTypeDescription
referenceFieldsstring[]

Array key that to be constrained.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReference(new String[]{"reference_uid_1", "reference_uid_2"}).Fetch<Entry>();

IncludeReference

Add a constraint that requires a particular reference key details.

NameTypeDescription
referenceFieldString

Key that to be constrained.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReference("reference_uid_1").Fetch<Entry>();

IncludeOnlyReference

Specifies an array of except keys that would be excluded in the response.

NameTypeDescription
keysstring[]

Array of the only reference keys to be included in response.

referenceKeystring

Key who has reference to some other class object.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeOnlyReference(new String[]{"name", "description"},"referenceUid").Fetch<Entry>();

IncludeExceptReference

Specifies an array of except keys that would be excluded in the response.

NameTypeDescription
keysstring[]

Array of the except reference keys to be excluded in response.

referenceKeystring

Key who has reference to some other class object.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeExceptReference(new String[]{"name", "description"},"referenceUid").Fetch<Entry>();

IncludeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeEmbeddedItems().Fetch<Entry>();

IncludeFallback

Include fallback locale publish content, if specified locale content is not publish.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeFallback().Fetch<Entry>();

IncludeMetadata

The includeMetadata method will add the meta information to the response.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeMetadata().Fetch<Entry>();

IncludeBranch

Include branch for publish content.

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeBranch().Fetch<Entry>();

Only

Specifies an array of 'only' keys in BASE object that would be 'included' in the response.

NameTypeDescription
fieldUidSystem.String[]

Array of the only reference keys to be included in response.

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

AssetLibrary assetLibrary = await stack.Entry().Only(new String[]{"name", "description"}).Fetch();

Except

Specifies list of field uids that would be excluded from the response.

NameTypeDescription
fieldUidsSystem.String[]

Field uid which get excluded from the response.

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

AssetLibrary assetLibrary = await stack.Entry("entry_uid").Except(new String[]{"name", "description"}).Fetch();

ToJson

Get key/value pairs in json of current instance.

using Contentstack.Core; 

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReferenceContentTypeUID().Fetch<Entry>();

JsonObject jObject = entry.ToJson();

Fetch

Fetches the latest version of the entries from Contentstack.io content stack

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Product product = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Product>();

Variants

The variants method retrieves details of a specific entry variant or an array of entry variants based on the applied query.

When Personalize creates a variant in the CMS, it assigns a "Variant Alias" to identify that specific variant. When fetching entry variants using the Delivery API, you can pass variant aliases in place of variant UIDs in the x-cs-variant-uid header.

NameTypeDescription
variant_headers (required)string | string[]

List of variants

Example:

using Contentstack.Core;

using Contentstack.Core.Models;


ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");


Entry entry = await stack

                    .ContentType("content_Type_uid")

                    .Entry("entry_uid")

                    .Variant(new String[]{"variant_uid1/variant_alias1", "variant_uid2/variant_alias2"})

                    .Fetch<Entry>();

assetFields

The assetFields method specifies which asset-related fields are included in the API response when fetching an entry or querying entries.

Regional Behavior

This method is currently supported only for stacks located in the North America (NA) region.

For stacks in the Europe (EU) or Azure North America (Azure NA) regions:

  • The API ignores the asset_fields[] parameter.
  • The response returns the default asset metadata.
  • The system does not return an error or warning message if the parameter is used.

If you are working in these regions, ensure your application logic accounts for the full default metadata response rather than a filtered set of fields.

NameTypeDescription
fieldsstring[]

Asset field names to include in the response.

Default: None

Returns the current Entry instance to enable method chaining. For example: Entry("id").AssetFields("...").Fetch<Entry>().

  • Request behavior: Calling AssetFields(...) only records the asset fields and does not make an API request.
  • Execution: The HTTP request runs only when you call Fetch<T>() (single entry) or Find<T>() (multiple entries).
  • Query parameter: The specified asset fields are sent as the asset_fields[] query parameter so that only those asset-related fields are returned in the response.

Parameter Behavior

  • Specifies which asset-related metadata fields the CDA returns for assets referenced in the entry or entries.
  • Applied when using stack.ContentType(uid).Entry(uid).AssetFields(...).Fetch<T>() or stack.ContentType(uid).Entry().AssetFields(...).Find<T>().
  • When provided, the SDK sends the selected fields as the asset_fields[] query parameter. Only the requested asset metadata is returned in the API response.

Supported Parameter Values

  • user_defined_fields
  • embedded_metadata
  • ai_generated_metadata
  • visual_markups

Note If AssetFields(...) is not called, or is called with no arguments, null, or an empty array, the SDK does not add the asset_fields[] query parameter. The CDA then returns the default asset metadata for referenced assets.

Fetch a single entry with specific fields

using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;

var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};

var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));

var entry = await stack
    .ContentType("blog_post")
    .Entry("entry_uid")
    .AssetFields("user_defined_fields", "embedded_metadata", "ai_generated_metadata")
    .Fetch<Entry>();

Query multiple entries with asset fields

using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;

var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};

var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));

var result = await stack
    .ContentType("blog_post")
    .Entry()
    .AssetFields("user_defined_fields", "embedded_metadata")
    .Find<Entry>();