BulkPublishDetails

View as Markdown

BulkPublishDetails

BulkPublishDetails lists the entries, assets, locales, and environments of a bulk publish or unpublish request. Pass it to the Publish and Unpublish methods of BulkOperation.

When to Use This Class: Use this class to describe the items that one bulk publish or unpublish request acts on.

Conceptual Role: Acts as the JSON request body of the /bulk/publish and /bulk/unpublish requests.

Returns: BulkPublishDetails. The items and targets of a bulk publish.

Properties

NameTypeRequiredDefaultDescription
EntriesList<BulkPublishEntry>?NonullEntries to act on. Serialized as entries. See BulkPublishEntry.
AssetsList<BulkPublishAsset>?NonullAssets to act on. Serialized as assets. See BulkPublishAsset.
LocalesList<string>?NonullLocale codes to act on. Serialized as locales.
EnvironmentsList<string>?NonullEnvironment names to act on. Serialized as environments.
RulesBulkPublishRules?NonullPublish rules setting. Serialized as rules. See BulkPublishRules.
ScheduledAtstring?NonullDate and time to run the operation, for example 2026-12-01T09:00:00.000Z. Serialized as scheduled_at.
PublishWithReferenceboolNofalsePublishes with references when true. Serialized as publish_with_reference.

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.

Value-type properties.

  • PublishWithReference is a bool, so the SDK always sends it. A model where you do not set it sends false.

API limits.

  • The Content Management API (CMA) reference allows up to 10 entries in 10 languages and 10 environments in one bulk publish or unpublish request. Split a larger list into several requests. See the Publish entries and assets in bulk request.

Method Index

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

Class-Level Snippet

The snippet below publishes one entry and one asset at a scheduled time, with every property set.

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}");
}