BulkPublishAsset
BulkPublishAsset
BulkPublishAsset identifies one asset in a bulk publish or unpublish request. Add it to BulkPublishDetails.Assets before you call the Publish and Unpublish methods.
When to Use This Class: Use this class once for each asset that a bulk publish or unpublish request acts on.
Conceptual Role: Acts as one object of the assets array in the request body.
Returns: BulkPublishAsset. One asset of a bulk publish.
Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Uid | string? | No | null | UID of the asset. Serialized as uid. |
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.
Locales and environments.
- An asset item carries only its UID. The request uses the Locales and Environments of the BulkPublishDetails that holds it.
Method Index
BulkPublishAsset 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 asset together with an entry.
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}");
}