BulkReleaseItem
BulkReleaseItem
BulkReleaseItem identifies one entry or asset in a bulk add-to-release request. Add it to BulkReleaseItemsData.Items before you call the ReleaseItems method.
When to Use This Class: Use this class once for each item that a bulk add-to-release request adds to a release.
Conceptual Role: Acts as one object of the items array in the request body.
Returns: BulkReleaseItem. One item of a bulk add-to-release request.
Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| ContentTypeUid | string? | No | null | UID of the content type. Serialized as content_type_uid. |
| Uid | string? | No | null | UID of the entry or asset. Serialized as uid. |
| Version | int | No | 0 | Version of the item. Serialized as version. |
| Locale | string? | No | null | Locale code of the item. Serialized as locale. |
| Title | string? | No | null | Title of the entry. Serialized as title. |
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.
- Version is a int, so the SDK always sends it. A model where you do not set it sends 0. Set the version on every item.
Method Index
BulkReleaseItem has no methods. Set its properties and pass it as shown in the Class-Level Snippet below.
Class-Level Snippet
The snippet below adds version 2 of one entry to a release.
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}");
}