BulkReleaseItemsData
BulkReleaseItemsData
BulkReleaseItemsData holds the release, the action, the locales, the reference flag, and the items of a bulk add-to-release request. Pass it to the ReleaseItems method of BulkOperation.
When to Use This Class: Use this class to add many entries and assets to a release in one request, with typed release items.
Conceptual Role: Acts as the JSON request body of the /bulk/release/items request.
Returns: BulkReleaseItemsData. The release and items of a bulk add-to-release request.
Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Release | string? | No | null | UID of the release. Serialized as release. |
| Action | string? | No | null | Release action, for example publish or unpublish. Serialized as action. |
| Locale | List<string>? | No | null | Locale codes of the items. Serialized as locale. |
| Reference | bool | No | false | Includes referenced items when true. Serialized as reference. |
| Items | List<BulkReleaseItem>? | No | null | Items to add. Serialized as items. See BulkReleaseItem. |
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.
- Reference is a bool, so the SDK always sends it. A model where you do not set it sends false.
Compared with BulkAddItemsData.
- BulkAddItemsData reaches the same Bulk Add to Release request through AddItems. Its Reference is a bool? that the SDK leaves out when null.
Method Index
BulkReleaseItemsData has no methods. Set its properties and pass it as shown in the Class-Level Snippet below.
Class-Level Snippet
The snippet below adds one entry, with its references, to a release for publishing.
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkReleaseItemsData data = new BulkReleaseItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Reference = true,
Items = new List<BulkReleaseItem>
{
new BulkReleaseItem() { ContentTypeUid = "<CONTENT_TYPE_UID>", Uid = "<ENTRY_UID>", Version = 2, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().ReleaseItems(data, "2.0");
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}");
}