PublishUnpublishDetails
PublishUnpublishDetails
PublishUnpublishDetails holds the environments, locales, variants, version, and schedule of a publish or unpublish request for an entry, an entry variant, or an asset.
When to Use This Class: Use this class whenever you publish or unpublish one entry or asset, for example to publish an entry to production in two locales.
Conceptual Role: Acts as the data model for the request body of the publish and unpublish methods.
Returns: PublishUnpublishDetails. The publish or unpublish details of one item.
Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Environments | List<string>? | No | null | Environment names to publish to. |
| Locales | List<string>? | No | null | Locale codes to publish in. |
| Variants | List<PublishVariant>? | No | null | Entry variants to include. |
| VariantRules | PublishVariantRules? | No | null | Rules for the base entry version. |
| Version | int? | No | null | Version of the item to publish. |
| ScheduledAt | string? | No | null | Date and time for a scheduled publish. |
Class-Level Notes
How the SDK builds the body.
- The SDK writes the body field by field instead of serializing the class, and maps each property to the key below:
- Under the entry key, or asset for an asset: Locales as locales, Environments as environments, Variants as variants, and VariantRules as variant_rules.
- At the top level of the body: Version as version and ScheduledAt as scheduled_at.
- The SDK leaves out a list that is null or empty, a null Version, and a null or empty ScheduledAt.
- The SDK does not check environment names, locale codes, or the date format. The API rejects values it cannot use.
Where the class is used.
- The Publish and Unpublish methods of Entry and their async versions.
- The Publish and Unpublish methods of EntryVariant, which add the variant to Variants before they send the request.
- The Publish and Unpublish methods of Asset.
Variants.
- Each item of Variants is a PublishVariant with a variant UID and version. The PublishVariantRules table on that page lists the fields of VariantRules.
- See Publish an entry and Publish entry variant in the Content Management API (CMA) reference.
Method Index
PublishUnpublishDetails has no methods. Set its properties and pass it to a publish or unpublish method.
Class-Level Snippet
The snippet below schedules version 3 of an entry for publishing in two locales.
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>");
PublishUnpublishDetails details = new PublishUnpublishDetails
{
Environments = new List<string> { "<ENVIRONMENT_NAME>" },
Locales = new List<string> { "en-us", "fr-fr" },
Version = 3,
ScheduledAt = "2026-12-01T09:00:00.000Z"
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").Publish(details, "en-us");
Console.WriteLine(response.OpenJsonObjectResponse()["notice"]);
}
catch (ContentstackErrorException e)
{
// Thrown when the API rejects the request
Console.WriteLine($"Request failed: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
}