Entry
Entry
An entry is an actual piece of content that you want to publish. You can create entries only for content types that have already been created.
Create
The Create an entry call creates a new entry for the selected content type.
| Name | Type | Description |
|---|---|---|
| model (required) | IEntry | IEntry for creating entry. |
| collection | ParameterCollection | Query parameter collection |
using Contentstack.Management.Core.Abstractions;
using System.Text.Json.Serialization;
namespace TestModels
{
public class EntryModel : IEntry
{
public EntryModel()
{
}
[JsonPropertyName("title")]
public string Title { get; set; } = "";
[JsonPropertyName("url")]
public string URL { get; set; } = "";
[JsonPropertyName("uid")]
public string Uid { get; set; } = "";
}
}Next, you need to set the data to the model. Here’s how you can do that:
EntryModel entryModel = new EntryModel()
{
Title = "Your Entry Title",
URL = "path/yoururl.com/example",
};The code below illustrates how to create an entry:
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryModel model = new EntryModel();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry().Create(model);CreateAsync
The Create an entry call creates a new entry for the selected content type.
| Name | Type | Description |
|---|---|---|
| model (required) | IEntry | IEntry for creating entry. |
| collection | ParameterCollection | Query parameter collection |
To create an entry, you need to prepare a custom model class that represents the entry's request body. To do so, create a separate EntryModel.cs file and add your custom EntryModel class, implementing IEntry interface, as follows:
using Contentstack.Management.Core.Abstractions;
using System.Text.Json.Serialization;
namespace TestModels
{
public class EntryModel : IEntry
{
public EntryModel()
{
}
[JsonPropertyName("title")]
public string Title { get; set; } = "";
[JsonPropertyName("url")]
public string URL { get; set; } = "";
[JsonPropertyName("uid")]
public string Uid { get; set; } = "";
}
}Next, you need to set the data to the model. Here’s how you can do that:
EntryModel entryModel = new EntryModel()
{
Title = "Your Entry Title",
URL = "path/yoururl.com/example",
};The code below illustrates how to update an entry
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryModel model = new EntryModel();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry().CreateAsync(model);Delete
The Delete Entry call deletes an existing entry and all the entries within it.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Delete();DeleteAsync
The Delete Entry call deletes an existing entry and all the entries within it.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").DeleteAsync();DeleteMultipleLocal
The Delete Locale will delete specific localized entries by passing the locale codes.
| Name | Type | Description |
|---|---|---|
| locales | List<string> | Enter the code of the language to unlocalize the entry of that particular language. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
List<string> locales = new List<string>();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").DeleteMultipleLocal(locales);DeleteMultipleLocalAsync
The Delete Locale will delete specific localized entries by passing the locale codes.
| Name | Type | Description |
|---|---|---|
| locales | List<string> | Enter the code of the language to unlocalize the entry of that particular language. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
List<string> locales = new List<string>();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").DeleteMultipleLocalAsync(locales);Export
The Export an entry call is used to export an entry. The exported entry data is saved in a downloadable JSON file.
| Name | Type | Description |
|---|---|---|
| filePath (required) | string | Path to file you want to export entry. |
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Export("PATH/TO/FILE");Fetch
The Fetch a single entry call returns information of a specific content type.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Fetch();FetchAsync
The Fetch a single entry call returns information of a specific content type.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").FetchAsync();Import
The Import an entry call is used to import an entry. To import an entry, you need to upload a JSON file that has entry data in the format that fits the schema of the content type it is being imported to.
| Name | Type | Description |
|---|---|---|
| filePath (required) | string | Path to file you want to import. |
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Import("PATH/TO/FILE");ImportAsync
The Import an entry call is used to import an entry. To import an entry, you need to upload a JSON file that has entry data in the format that fits the schema of the content type it is being imported to.
| Name | Type | Description |
|---|---|---|
| filePath (required) | string | Path to file you want to import. |
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").ImportAsync("PATH/TO/FILE");Locales
The Get languages of an entry call returns the details of all the languages that an entry exists in.
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Locales();LocalesAsync
The Get languages of an entry call returns the details of all the languages that an entry exists in.
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").LocalesAsync();Localize
The Localize an entry request allows you to localize an entry i.e., the entry will cease to fetch data from its fallback language and possess independent content specific to the selected locale.
| Name | Type | Description |
|---|---|---|
| model (required) | IEntry | Localized IEntry model. |
| locale | string | Enter the code of the language to unlocalize the entry of that particular language. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryModel model = new EntryModel();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Localize(model, "hi-in");LocalizeAsync
The Localize an entry request allows you to localize an entry i.e., the entry will cease to fetch data from its fallback language and possess independent content specific to the selected locale.
| Name | Type | Description |
|---|---|---|
| model (required) | IEntry | Localized IEntry model. |
| locale | string | Enter the code of the language to unlocalize the entry of that particular language. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryModel model = new EntryModel();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").LocalizeAsync(model, "hi-in");Publish
The Publish an entry request lets you publish an entry either immediately or schedule it for a later date/time.
| Name | Type | Description |
|---|---|---|
| details (required) | PublishUnpublishDetails | Publish details for publishing entry. |
| locale | string | Locale for which entry to be published. |
| apiVersion | string | API version to pass in headers. Pass the value 3.2 to use latest Publish API. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
PublishUnpublishDetails details = new PublishUnpublishDetails();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Publish(details, "en-us", apiVersion: "3.2");PublishAsync
The Publish an entry request lets you publish an entry either immediately or schedule it for a later date/time.
| Name | Type | Description |
|---|---|---|
| details (required) | PublishUnpublishDetails | Publish details for publishing entry. |
| locale | string | Locale for which entry to be published. |
| apiVersion | string | API version to pass in headers. Pass the value 3.2 to use latest Publish API. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
PublishUnpublishDetails details = new PublishUnpublishDetails();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").PublishAsync(details, "en-us", apiVersion: "3.2");PublishRequest
This multipurpose request allows you to either send a publish request or accept/reject a received publish request.
| Name | Type | Description |
|---|---|---|
| action (required) | EntryPublishAction | EntryPublishAction for setting entry to publish request. |
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryPublishAction model = new EntryPublishAction();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").PublishRequest(model);PublishRequestAsync
This multipurpose request allows you to either send a publish request or accept/reject a received publish request.
| Name | Type | Description |
|---|---|---|
| action (required) | EntryPublishAction | EntryPublishAction for setting entry to publish request. |
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryPublishAction model = new EntryPublishAction();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").PublishRequestAsync(model);Query
The Query on Entry 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>").ContentType("<CONTENT_TYPE_UID>").Entry().Query();References
The Get references of an entry call returns all the entries of content types that are referenced by a particular entry.
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").References();ReferencesAsync
The Get references of an entry call returns all the entries of content types that are referenced by a particular entry.
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").ReferencesAsync();SetWorkflow
The Set Entry Workflow Stage request allows you to either set a particular workflow stage of an entry or update the workflow stage details of an entry.
| Name | Type | Description |
|---|---|---|
| model (required) | EntryWorkflowStage | EntryWorkflowStage object for setting entry to workflow stage. |
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryWorkflowStage model = new EntryWorkflowStage();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").SetWorkflow(model);SetWorkflowAsync
The Set Entry Workflow Stage request allows you to either set a particular workflow stage of an entry or update the workflow stage details of an entry.
| Name | Type | Description |
|---|---|---|
| model (required) | EntryWorkflowStage | EntryWorkflowStage object for setting entry to workflow stage. |
| collection | ParameterCollection | Query parameter. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryWorkflowStage model = new EntryWorkflowStage();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").SetWorkflowAsync(model);Unlocalize
The Unlocalize an entry request is used to unlocalize an existing entry.
| Name | Type | Description |
|---|---|---|
| locale | string | Enter the code of the language to unlocalize the entry of that particular language. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Unlocalize("hi-in");UnlocalizeAsync
The Unlocalize an entry request is used to unlocalize an existing entry.
| Name | Type | Description |
|---|---|---|
| locale | string | Enter the code of the language to unlocalize the entry of that particular language. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").UnlocalizeAsync("hi-in");Unpublish
The Unpublish an entry call will unpublish an entry at once, and also, gives you the provision to unpublish an entry automatically at a later date/time.
| Name | Type | Description |
|---|---|---|
| details (required) | PublishUnpublishDetails | Publish details for un-publishing entry. |
| locale | string | Locale for which entry to be un-published. |
| apiVersion | string | API version to pass in headers. Pass the value 3.2 to use latest Unpublish API. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
PublishUnpublishDetails details = new PublishUnpublishDetails();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Unpublish(details, "en-us", apiVersion: "3.2");UnpublishAsync
The Unpublish an entry call will unpublish an entry at once, and also, gives you the provision to unpublish an entry automatically at a later date/time.
| Name | Type | Description |
|---|---|---|
| details (required) | PublishUnpublishDetails | Publish details for un-publishing entry. |
| locale | string | Locale for which entry to be un-published. |
| apiVersion | string | API version to pass in headers. Pass the value 3.2 to use latest Unpublish API. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
PublishUnpublishDetails details = new PublishUnpublishDetails();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").UnpublishAsync(details, "en-us", apiVersion: "3.2");Update
The Update Entry call is used to update the content of an existing entry.
| Name | Type | Description |
|---|---|---|
| model (required) | IEntry | IEntry for updating entry. |
| collection | ParameterCollection | Query parameter collection |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryModel model = new EntryModel();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("ENTRY_UID").Update(model);UpdateAsync
The Update Entry call is used to update the content of an existing entry.
| Name | Type | Description |
|---|---|---|
| model (required) | IEntry | IEntry for updating entry. |
| collection | ParameterCollection | Query parameter collection |
To update an entry, you need to prepare a custom model class that represents the entry's request body. To do so, create a separate EntryModel.cs file and add your custom EntryModel class, implementing IEntry interface, as follows:
using Contentstack.Management.Core.Abstractions;
using System.Text.Json.Serialization;
namespace TestModels
{
public class EntryModel : IEntry
{
public EntryModel()
{
}
[JsonPropertyName("title")]
public string Title { get; set; } = "";
[JsonPropertyName("url")]
public string URL { get; set; } = "";
[JsonPropertyName("uid")]
public string Uid { get; set; } = "";
}
}Next, you need to set the data to the model. Here’s how you can do that:
EntryModel entryModel = new EntryModel()
{
Title = "Your Entry Title",
URL = "path/yoururl.com/example",
};The code below illustrates how to update an entry
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EntryModel model = new EntryModel();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("ENTRY_UID").UpdateAsync(model);Version
The Version on Entry will allow to fetch all version, delete specific version or naming the asset version.
| Name | Type | Description |
|---|---|---|
| versionNumber | int | Version number for the entry. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
Version version = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry().Version();