BulkPublishEntry

View as Markdown

BulkPublishEntry

BulkPublishEntry identifies one entry in a bulk publish or unpublish request. Add it to BulkPublishDetails.Entries before you call the Publish and Unpublish methods.

When to Use This Class: Use this class once for each entry that a bulk publish or unpublish request acts on.

Conceptual Role: Acts as one object of the entries array in the request body.

Returns: BulkPublishEntry. One entry of a bulk publish.

Properties

NameTypeRequiredDefaultDescription
Uidstring?NonullUID of the entry. Serialized as uid.
ContentTypestring?NonullUID of the content type of the entry. Serialized as content_type.
VersionintNo0Version of the entry to act on. Serialized as version.
Localestring?NonullLocale code of the entry. Serialized as locale.

Class-Level Notes

Serialization.

  • The SDK serializes the model with System.Text.Json and leaves out every property that is null. The SDK does not check the values.

Set the version on every entry.

  • Version is an int, so the SDK always sends it, and 0 when you do not set it.
  • The Content Management API (CMA) reference treats the version as optional and acts on the latest version when a request has none. The SDK cannot leave the version out, so set the version you want.

Method Index

BulkPublishEntry has no methods. Set its properties and pass it as shown in the Class-Level Snippet below.

Class-Level Snippet

The snippet below publishes version 2 of one entry, together with an asset.

using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");

BulkPublishDetails details = new BulkPublishDetails()
{
    Entries = new List<BulkPublishEntry>
    {
        new BulkPublishEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Version = 2, Locale = "<LOCALE_CODE>" }
    },
    Assets = new List<BulkPublishAsset>
    {
        new BulkPublishAsset() { Uid = "<ASSET_UID>" }
    },
    Locales = new List<string> { "<LOCALE_CODE>" },
    Environments = new List<string> { "<ENVIRONMENT_NAME>" },
    Rules = new BulkPublishRules() { Approvals = "true" },
    ScheduledAt = "2026-12-01T09:00:00.000Z",
    PublishWithReference = true
};

try
{
    ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().Publish(details);
    Console.WriteLine(response.OpenJsonObjectResponse().ToJsonString());
}
catch (ContentstackErrorException e)
{
    // Thrown when the API rejects the request
    Console.WriteLine($"Request failed: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
}