Bulk Operations
Bulk Operations
The BulkOperation class acts on many entries and assets in one request. It runs the bulk operations of the Content Management API (CMA) listed below:
- Publish, unpublish, and delete many entries and assets.
- Change the workflow details of many entries.
- Add many entries and assets to a release.
- Read the status of a bulk job.
When to Use This Class: Use this class when your code acts on a batch of items, for example a nightly publish of every changed entry. One bulk request replaces one request per item.
Conceptual Role: Acts as the CMA client for the /bulk endpoints. Call stack.BulkOperation() to get an instance. The instance holds no state, so one instance serves any number of calls.
Returns: BulkOperation. A handle for bulk operations.
Class-Level Notes
Authentication.
- stack.BulkOperation() throws InvalidOperationException when the client has no authtoken and the Stack has no management token, and when the Stack has no API key. Every method repeats both checks when you call it.
- The CMA reference lists an authtoken, an Open Authorization (OAuth) token, or a management token for the publish, unpublish, delete, and workflow requests.
- The CMA reference lists a management token for the Bulk Add to Release and Get job status requests. Create the Stack with client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>") for those methods.
Request bodies.
- Each method serializes its model class, for example BulkPublishDetails, as the JSON body. The SDK leaves out every property that is null.
- Properties of type bool or int always reach the body, because they cannot be null. A value you do not set goes out as false or 0. Each model page names these properties.
- The SDK does not check the content of a model. Invalid UIDs, locales, or environment names reach the API and fail there.
API limits.
- The CMA reference allows one bulk request per second, instead of the standard rate limit of 10 requests per second.
- One bulk publish or unpublish request takes up to 10 entries in 10 languages and 10 environments. One bulk delete request takes up to 100 entries.
- The SDK does not split a large list into several requests. Split the list in your code.
Headers.
- Publish and Unpublish send the api_version header when you pass apiVersion.
- AddItems, UpdateItems, ReleaseItems, JobStatus, and their variants send the bulk_version header when the bulkVersion value is not null or empty. AddItems and UpdateItems send 1.0 by default, and the others send no header by default. The CMA reference asks for bulk_version set to 2.0 on Bulk Add to Release.
Bulk jobs.
- The CMA runs bulk operations as jobs. Read the progress of a job with JobStatus and the job ID.
Branch scoping.
- The branchUid argument of client.Stack() adds a branch header to every request from that Stack. The CMA reference lists the branch header for the publish, unpublish, delete, and workflow requests.
Errors.
- The SDK throws ContentstackErrorException when the API returns an error status. Read StatusCode, ErrorCode, ErrorMessage, and Errors on the exception to see what the API rejected.
- A method that returns without throwing returns a ContentstackResponse with a success status. Read its body with OpenJsonObjectResponse() or OpenTResponse<T>().
Rate Limiting & Retry.
- This SDK automatically retries a request that returns 429, 500, 502, 503, or 504, with configurable delay and attempt limits. The bulk limit of one request per second makes 429 responses more likely when you send batches in a loop.
Additional Resource For more information on retry limits and delay, refer to the ContentstackClientOptions documentation.
Async methods.
- The async methods run the same client-side checks as soon as you call them, before they return a task.
Capability Matrix
| Capability | Supported | Notes / Alternative |
|---|---|---|
| Split a large list into several requests | No | Send one request per batch of 10 for publish and unpublish, or 100 for delete. The Publish page shows a batch loop. |
| Send the api_version header with JobStatus | No | JobStatus has no argument for it. The CMA reference lists api_version set to 3.2 for Get job status. |
| List the items of a job (/bulk/jobs/<JOB_ID>/items) | No | The CMA Get job items status request has no method in this SDK. |
| List every bulk job of a stack (/bulk/jobs) | No | The CMA Get Stack Bulk Task Queue request has no method in this SDK. |
Method Index
Publish and unpublish. Available on stack.BulkOperation().
| Method Name | Returns | Description |
|---|---|---|
| Publish | The API response with the bulk publish notice. | Publishes many entries and assets. |
| PublishAsync | The API response with the bulk publish notice. | Publishes many entries and assets asynchronously. |
| Unpublish | The API response with the bulk unpublish notice. | Unpublishes many entries and assets. |
| UnpublishAsync | The API response with the bulk unpublish notice. | Unpublishes many entries and assets asynchronously. |
Delete. Available on stack.BulkOperation().
| Method Name | Returns | Description |
|---|---|---|
| Delete | The API response with the bulk delete notice. | Deletes many entries and assets. |
| DeleteAsync | The API response with the bulk delete notice. | Deletes many entries and assets asynchronously. |
Change workflow details. Available on stack.BulkOperation().
| Method Name | Returns | Description |
|---|---|---|
| Update | The API response with the bulk workflow update notice. | Changes the workflow stage of many entries. |
| UpdateAsync | The API response with the bulk workflow update notice. | Changes the workflow stage of many entries asynchronously. |
Add items to a release. Available on stack.BulkOperation().
| Method Name | Returns | Description |
|---|---|---|
| AddItems | The API response with the bulk add-to-release notice. | Adds many items to a release. |
| AddItemsAsync | The API response with the bulk add-to-release notice. | Adds many items to a release asynchronously. |
| AddItemsWithDeployment | The API response with the bulk add-to-release notice. | Sets the release and action, then adds items. |
| AddItemsWithDeploymentAsync | The API response with the bulk add-to-release notice. | Sets the release and action, then adds items asynchronously. |
| ReleaseItems | The API response with the bulk add-to-release notice. | Adds typed release items to a release. |
| ReleaseItemsAsync | The API response with the bulk add-to-release notice. | Adds typed release items to a release asynchronously. |
| UpdateItems | The API response with the bulk update-items notice. | Sends release items to the update-items endpoint. |
| UpdateItemsAsync | The API response with the bulk update-items notice. | Sends release items to the update-items endpoint asynchronously. |
| UpdateItemsWithDeployment | The API response with the bulk update-items notice. | Sets the release and action, then sends items. |
| UpdateItemsWithDeploymentAsync | The API response with the bulk update-items notice. | Sets the release and action, then sends items asynchronously. |
Check a bulk job. Available on stack.BulkOperation().
| Method Name | Returns | Description |
|---|---|---|
| JobStatus | The API response with the job status. | Retrieves the status of a bulk job. |
| JobStatusAsync | The API response with the job status. | Retrieves the status of a bulk job asynchronously. |
Class-Level Snippet
The snippet below publishes two entries and an asset to one environment in a single request.
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkOperation bulk = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation();
BulkPublishDetails details = new BulkPublishDetails()
{
Entries = new List<BulkPublishEntry>
{
new BulkPublishEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>" },
new BulkPublishEntry() { Uid = "<SECOND_ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Version = 3, Locale = "<LOCALE_CODE>" }
},
Assets = new List<BulkPublishAsset> { new BulkPublishAsset() { Uid = "<ASSET_UID>" } },
Locales = new List<string> { "<LOCALE_CODE>" },
Environments = new List<string> { "<ENVIRONMENT_NAME>" }
};
try
{
ContentstackResponse response = await bulk.PublishAsync(details, skipWorkflowStage: true, approvals: true);
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}");
}Methods
Each method of the BulkOperation class has its own section below, with its parameters, validation rules, behavior, and examples.
AddItems
AddItems adds many entries and assets to a release in one request.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Sets the release, action, locales, and items. |
| bulkVersion | string | Sends this value in the bulk_version header. |
Returns: ContentstackResponse. The API response with the bulk add-to-release notice.
Validation
- Throws ArgumentNullException if data is null, because the data is the request body.
- The SDK does not check bulkVersion or the items. An empty bulkVersion sends no bulk_version header.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one POST request to /bulk/release/items, the Bulk Add to Release request.
- Serializes BulkAddItemsData as the JSON body and leaves out the properties that are null. Set Release and Action on data yourself, or call AddItemsWithDeployment, which sets them from its arguments.
- Sends bulkVersion as the bulk_version header, 1.0 when you omit it. The Content Management API (CMA) reference for Bulk Add to Release requires bulk_version set to 2.0, so pass "2.0".
- Returns the raw API response.
Example
Basic usage: send one entry for 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("<AUTHTOKEN>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().AddItems(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}");
}All parameters: send two entries with their references
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Reference = true,
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 2, Locale = "<LOCALE_CODE>", Title = "Spring Sale" },
new BulkAddItem() { Uid = "<SECOND_ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Summer Preview" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().AddItems(data, bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: omit bulkVersion and send the 1.0 header
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>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
// Sends bulk_version: 1.0. The CMA reference asks for 2.0 on Bulk Add to Release.
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().AddItems(data);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}AddItemsAsync
AddItemsAsync adds many entries and assets to a release in one request, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Sets the release, action, locales, and items. |
| bulkVersion | string | Sends this value in the bulk_version header. |
Returns: Task<ContentstackResponse>. The API response with the bulk add-to-release notice.
Validation
- Throws ArgumentNullException if data is null, because the data is the request body.
- The SDK throws the exceptions above when you call AddItemsAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like AddItems.
Example
Basic usage: send one entry for a release
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().AddItemsAsync(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}");
}All parameters: send two entries with their references
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Reference = true,
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 2, Locale = "<LOCALE_CODE>", Title = "Spring Sale" },
new BulkAddItem() { Uid = "<SECOND_ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Summer Preview" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().AddItemsAsync(data, bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}AddItemsWithDeployment
AddItemsWithDeployment sets the release, action, locales, and reference flag on data, then calls the same endpoint as AddItems.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Holds the items. The method overwrites its release fields. |
| releaseUid (required) | string | Sets the UID of the target release. |
| action (required) | string | Sets the release action, publish or unpublish. |
| locales | List<string>? | Sets the locales of the release items. |
| reference | bool? | Includes the referenced items when true. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: ContentstackResponse. The API response with the bulk add-to-release notice.
Validation
- Throws NullReferenceException if data is null, because the method writes to data before the SDK checks it.
- The SDK does not check releaseUid, action, or locales. A null releaseUid or action leaves that key out of the body.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Writes releaseUid, action, locales, and reference to data.Release, data.Action, data.Locale, and data.Reference. These writes replace the values that data held, even when the argument is null, and they remain on data after the call.
- Then sends the same request as AddItems: one POST request to /bulk/release/items.
- Sends bulkVersion as the bulk_version header only when it is not null or empty. With the default null, the request carries no bulk_version header. The Content Management API (CMA) reference for Bulk Add to Release requires bulk_version set to 2.0, so pass "2.0".
- action takes the release action, publish or unpublish, per the CMA reference.
- Returns the raw API response.
Example
Basic usage: send one entry for a release to publish
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>");
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().AddItemsWithDeployment(data, "<RELEASE_UID>", "publish", bulkVersion: "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}");
}All parameters: send items with locales and references
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().AddItemsWithDeployment(
data,
"<RELEASE_UID>",
"publish",
locales: new List<string> { "<LOCALE_CODE>" },
reference: true,
bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: the method replaces the release fields on data
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>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
// data.Locale and data.Reference become null, because locales and reference are omitted.
client.Stack("<API_KEY>").BulkOperation().AddItemsWithDeployment(data, "<RELEASE_UID>", "unpublish", bulkVersion: "2.0");
Console.WriteLine($"{data.Action} {data.Locale == null}");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}AddItemsWithDeploymentAsync
AddItemsWithDeploymentAsync sets the release, action, locales, and reference flag on data, then calls the same endpoint as AddItems, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Holds the items. The method overwrites its release fields. |
| releaseUid (required) | string | Sets the UID of the target release. |
| action (required) | string | Sets the release action, publish or unpublish. |
| locales | List<string>? | Sets the locales of the release items. |
| reference | bool? | Includes the referenced items when true. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: Task<ContentstackResponse>. The API response with the bulk add-to-release notice.
Validation
- Throws NullReferenceException if data is null, because the method writes to data before the SDK checks it.
- The SDK throws the exceptions above when you call AddItemsWithDeploymentAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like AddItemsWithDeployment.
Example
Basic usage: send one entry for a release to publish
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().AddItemsWithDeploymentAsync(data, "<RELEASE_UID>", "publish", bulkVersion: "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}");
}All parameters: send items with locales and references
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().AddItemsWithDeploymentAsync(
data,
"<RELEASE_UID>",
"publish",
locales: new List<string> { "<LOCALE_CODE>" },
reference: true,
bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Delete
Delete deletes many entries and assets in one request.
| Name | Type | Description |
|---|---|---|
| details (required) | BulkDeleteDetails | Lists the entries and assets to delete. |
Returns: ContentstackResponse. The API response with the bulk delete notice.
Validation
- Throws ArgumentNullException if details is null, because the details are the request body.
- The SDK does not check the number of items or whether the lists are empty. Invalid values reach the API and fail there.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one POST request to /bulk/delete, the Delete entries and assets in bulk request.
- Serializes BulkDeleteDetails as the JSON body and leaves out the properties that are null.
- The Content Management API (CMA) reference allows up to 100 entries in one bulk delete request. The SDK does not split the list.
- Returns the raw API response.
Example
Warning Delete deletes every listed entry and asset from the stack. Check the list before you send it.
Basic usage: delete an entry and an asset
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>");
BulkDeleteDetails details = new BulkDeleteDetails()
{
Entries = new List<BulkDeleteEntry>
{
new BulkDeleteEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
},
Assets = new List<BulkDeleteAsset>
{
new BulkDeleteAsset() { Uid = "<ASSET_UID>" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().Delete(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}");
}Delete entries with a management token
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkDeleteDetails details = new BulkDeleteDetails()
{
Entries = new List<BulkDeleteEntry>
{
new BulkDeleteEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" },
new BulkDeleteEntry() { Uid = "<SECOND_ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().Delete(details);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}DeleteAsync
DeleteAsync deletes many entries and assets in one request, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| details (required) | BulkDeleteDetails | Lists the entries and assets to delete. |
Returns: Task<ContentstackResponse>. The API response with the bulk delete notice.
Validation
- Throws ArgumentNullException if details is null, because the details are the request body.
- The SDK throws the exceptions above when you call DeleteAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like Delete.
Example
Warning DeleteAsync deletes every listed entry and asset from the stack. Check the list before you send it.
Basic usage: delete an entry and an asset
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkDeleteDetails details = new BulkDeleteDetails()
{
Entries = new List<BulkDeleteEntry>
{
new BulkDeleteEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
},
Assets = new List<BulkDeleteAsset>
{
new BulkDeleteAsset() { Uid = "<ASSET_UID>" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().DeleteAsync(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}");
}Delete entries with a management token
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkDeleteDetails details = new BulkDeleteDetails()
{
Entries = new List<BulkDeleteEntry>
{
new BulkDeleteEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" },
new BulkDeleteEntry() { Uid = "<SECOND_ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().DeleteAsync(details);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}JobStatus
JobStatus retrieves the status of one bulk job.
| Name | Type | Description |
|---|---|---|
| jobId (required) | string | Selects the bulk job to read. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: ContentstackResponse. The API response with the job status.
Validation
- Throws ArgumentNullException if jobId is null, empty, or only white space, because the job ID is part of the request path. The SDK runs this check before the login check.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one GET request to /bulk/jobs/<JOB_ID>, the Get job status request.
- Sends bulkVersion as the bulk_version header only when it is not null or empty.
- Sends no api_version header, and the method has no argument for one. The Content Management API (CMA) reference lists api_version set to 3.2 as a required header for this request.
- The CMA reference lists a management token in the authorization header for this request. Create the Stack with a management token.
- Returns the raw API response.
Example
Basic usage: read the status of a bulk job
using System;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().JobStatus("<JOB_ID>");
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}");
}All parameters: read a job status with a bulk version header
using System;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().JobStatus("<JOB_ID>", bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: an empty job ID throws before any request
using System;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
try
{
client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().JobStatus(" ");
}
catch (ArgumentNullException e)
{
// Thrown when jobId is null, empty, or white space
Console.WriteLine(e.ParamName);
}JobStatusAsync
JobStatusAsync retrieves the status of one bulk job, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| jobId (required) | string | Selects the bulk job to read. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: Task<ContentstackResponse>. The API response with the job status.
Validation
- Throws ArgumentNullException if jobId is null, empty, or only white space, because the job ID is part of the request path. The SDK runs this check before the login check.
- The SDK throws the exceptions above when you call JobStatusAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like JobStatus.
Example
Basic usage: read the status of a bulk job
using System;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().JobStatusAsync("<JOB_ID>");
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}");
}All parameters: read a job status with a bulk version header
using System;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().JobStatusAsync("<JOB_ID>", bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: an empty job ID throws before any request
using System;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
try
{
await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().JobStatusAsync(" ");
}
catch (ArgumentNullException e)
{
// Thrown when jobId is null, empty, or white space
Console.WriteLine(e.ParamName);
}Publish
Publish publishes many entries and assets to one or more environments in one request.
| Name | Type | Description |
|---|---|---|
| details (required) | BulkPublishDetails | Lists the entries, assets, locales, and environments. |
| skipWorkflowStage | bool | Adds skip_workflow_stage_check=true to the request. |
| approvals | bool | Adds approvals=true to the request. |
| isNested | bool | Adds nested=true and event_type=bulk to the request. |
| apiVersion | string? | Sends this value in the api_version header. |
Returns: ContentstackResponse. The API response with the bulk publish notice.
Validation
- Throws ArgumentNullException if details is null, because the details are the request body.
- The SDK does not check the number of items, locales, or environments, or whether the lists are empty. Invalid values reach the API and fail there.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one POST request to /bulk/publish, the Publish entries and assets in bulk request.
- Adds a query parameter only for a flag set to true. A flag left false sends nothing, and the API applies its own behavior.
- skipWorkflowStage sends skip_workflow_stage_check=true. The Content Management API (CMA) reference uses it to publish the entries whose workflow stage satisfies the publish rules.
- approvals sends approvals=true. The CMA reference uses it to publish the entries that need no approval.
- isNested sends nested=true and event_type=bulk. The CMA reference does not list these two parameters.
- Sends apiVersion as the api_version header only when it is not null or empty. The CMA reference lists this header for the request and uses 3.2 to publish nested references up to five levels deep together with their parent entries.
- Serializes BulkPublishDetails as the JSON body and leaves out the properties that are null.
- Always sends publish_with_reference, and false when you do not set PublishWithReference.
- Always sends version for each entry, because BulkPublishEntry.Version is an int with a default of 0. The CMA reference treats the version as optional and publishes the latest version when the request has none. Set Version on every entry.
- The CMA reference allows up to 10 entries in 10 languages and 10 environments in one request, and one bulk request per second. The SDK sends the lists as you build them and does not split them.
- Returns the raw API response.
Example
Basic usage: publish one entry to one environment
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 = 1, Locale = "<LOCALE_CODE>" }
},
Locales = new List<string> { "<LOCALE_CODE>" },
Environments = new List<string> { "<ENVIRONMENT_NAME>" }
};
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}");
}All parameters: schedule a publish of entries and assets with nested references
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
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>", "<MANAGEMENT_TOKEN>").BulkOperation().Publish(
details,
skipWorkflowStage: true,
approvals: true,
isNested: true,
apiVersion: "3.2");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: publish more than 10 entries in batches of 10
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
using System.Linq;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkOperation bulk = client.Stack("<API_KEY>").BulkOperation();
List<string> entryUids = new List<string> { "<ENTRY_UID>", "<SECOND_ENTRY_UID>" };
// The API accepts up to 10 entries per bulk request, so send one request per batch.
foreach (string[] batch in entryUids.Chunk(10))
{
BulkPublishDetails details = new BulkPublishDetails()
{
Entries = batch.Select(uid => new BulkPublishEntry() { Uid = uid, ContentType = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>" }).ToList(),
Locales = new List<string> { "<LOCALE_CODE>" },
Environments = new List<string> { "<ENVIRONMENT_NAME>" }
};
try
{
bulk.Publish(details);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}
}PublishAsync
PublishAsync publishes many entries and assets to one or more environments in one request, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| details (required) | BulkPublishDetails | Lists the entries, assets, locales, and environments. |
| skipWorkflowStage | bool | Adds skip_workflow_stage_check=true to the request. |
| approvals | bool | Adds approvals=true to the request. |
| isNested | bool | Adds nested=true and event_type=bulk to the request. |
| apiVersion | string? | Sends this value in the api_version header. |
Returns: Task<ContentstackResponse>. The API response with the bulk publish notice.
Validation
- Throws ArgumentNullException if details is null, because the details are the request body.
- The SDK throws the exceptions above when you call PublishAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like Publish.
Example
Basic usage: publish one entry to one environment
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
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 = 1, Locale = "<LOCALE_CODE>" }
},
Locales = new List<string> { "<LOCALE_CODE>" },
Environments = new List<string> { "<ENVIRONMENT_NAME>" }
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().PublishAsync(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}");
}All parameters: schedule a publish of entries and assets with nested references
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
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 = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().PublishAsync(
details,
skipWorkflowStage: true,
approvals: true,
isNested: true,
apiVersion: "3.2");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}ReleaseItems
ReleaseItems adds many entries and assets to a release in one request, from a body with typed release items.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkReleaseItemsData | Sets the release, action, locales, and items. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: ContentstackResponse. The API response with the bulk add-to-release notice.
Validation
- Throws ArgumentNullException if data is null, because the data is the request body.
- The SDK does not check the release UID, the action, or the items.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one POST request to /bulk/release/items, the Bulk Add to Release request. AddItems sends the same request with a BulkAddItemsData body.
- Serializes BulkReleaseItemsData as the JSON body and leaves out the properties that are null. reference and each item version are value types, so the SDK always sends them (false and 0 when unset).
- Sends bulkVersion as the bulk_version header only when it is not null or empty. The Content Management API (CMA) reference for Bulk Add to Release requires bulk_version set to 2.0, so pass "2.0".
- Returns the raw API response.
Example
Basic usage: add 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("<AUTHTOKEN>");
BulkReleaseItemsData data = new BulkReleaseItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkReleaseItem>
{
new BulkReleaseItem() { ContentTypeUid = "<CONTENT_TYPE_UID>", Uid = "<ENTRY_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").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}");
}All parameters: add two entries for unpublishing with their references
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 = "unpublish",
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" },
new BulkReleaseItem() { ContentTypeUid = "<CONTENT_TYPE_UID>", Uid = "<SECOND_ENTRY_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Summer Preview" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().ReleaseItems(data, bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}ReleaseItemsAsync
ReleaseItemsAsync adds many entries and assets to a release in one request, from a body with typed release items, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkReleaseItemsData | Sets the release, action, locales, and items. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: Task<ContentstackResponse>. The API response with the bulk add-to-release notice.
Validation
- Throws ArgumentNullException if data is null, because the data is the request body.
- The SDK throws the exceptions above when you call ReleaseItemsAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like ReleaseItems.
Example
Basic usage: add one entry to a release
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkReleaseItemsData data = new BulkReleaseItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkReleaseItem>
{
new BulkReleaseItem() { ContentTypeUid = "<CONTENT_TYPE_UID>", Uid = "<ENTRY_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().ReleaseItemsAsync(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}");
}All parameters: add two entries for unpublishing with their references
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
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 = "unpublish",
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" },
new BulkReleaseItem() { ContentTypeUid = "<CONTENT_TYPE_UID>", Uid = "<SECOND_ENTRY_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Summer Preview" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().ReleaseItemsAsync(data, bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Unpublish
Unpublish unpublishes many entries and assets from one or more environments in one request.
| Name | Type | Description |
|---|---|---|
| details (required) | BulkPublishDetails | Lists the entries, assets, locales, and environments. |
| skipWorkflowStage | bool | Adds skip_workflow_stage_check=true to the request. |
| approvals | bool | Adds approvals=true to the request. |
| isNested | bool | Adds nested=true and event_type=bulk to the request. |
| apiVersion | string? | Sends this value in the api_version header. |
Returns: ContentstackResponse. The API response with the bulk unpublish notice.
Validation
- Throws ArgumentNullException if details is null, because the details are the request body.
- The SDK does not check the number of items, locales, or environments, or whether the lists are empty. Invalid values reach the API and fail there.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one POST request to /bulk/unpublish, the Unpublish entries and assets in bulk request.
- Adds a query parameter only for a flag set to true. A flag left false sends nothing, and the API applies its own behavior.
- skipWorkflowStage sends skip_workflow_stage_check=true. The Content Management API (CMA) reference uses it to unpublish the entries whose workflow stage satisfies the publish rules.
- approvals sends approvals=true. The CMA reference uses it to unpublish the entries that need no approval.
- isNested sends nested=true and event_type=bulk. The CMA reference does not list these two parameters.
- Sends apiVersion as the api_version header only when it is not null or empty. The CMA reference uses 3.2 to log the unpublish task with the nested flow.
- Serializes BulkPublishDetails as the JSON body and leaves out the properties that are null.
- Always sends publish_with_reference, and false when you do not set PublishWithReference.
- Always sends version for each entry, because BulkPublishEntry.Version is an int with a default of 0. The CMA reference treats the version as optional and unpublishes the latest version when the request has none. Set Version on every entry.
- The CMA reference allows up to 10 entries in 10 languages and 10 environments in one request, and one bulk request per second. The SDK sends the lists as you build them and does not split them.
- Returns the raw API response.
Example
Warning Unpublish removes every listed entry and asset from the environments you name. Content delivery requests to those environments stop returning them.
Basic usage: unpublish one entry from one environment
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 = 1, Locale = "<LOCALE_CODE>" }
},
Locales = new List<string> { "<LOCALE_CODE>" },
Environments = new List<string> { "<ENVIRONMENT_NAME>" }
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().Unpublish(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}");
}All parameters: schedule a unpublish of entries and assets with nested references
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
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>", "<MANAGEMENT_TOKEN>").BulkOperation().Unpublish(
details,
skipWorkflowStage: true,
approvals: true,
isNested: true,
apiVersion: "3.2");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: unpublish more than 10 entries in batches of 10
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
using System.Linq;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkOperation bulk = client.Stack("<API_KEY>").BulkOperation();
List<string> entryUids = new List<string> { "<ENTRY_UID>", "<SECOND_ENTRY_UID>" };
// The API accepts up to 10 entries per bulk request, so send one request per batch.
foreach (string[] batch in entryUids.Chunk(10))
{
BulkPublishDetails details = new BulkPublishDetails()
{
Entries = batch.Select(uid => new BulkPublishEntry() { Uid = uid, ContentType = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>" }).ToList(),
Locales = new List<string> { "<LOCALE_CODE>" },
Environments = new List<string> { "<ENVIRONMENT_NAME>" }
};
try
{
bulk.Unpublish(details);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}
}UnpublishAsync
UnpublishAsync unpublishes many entries and assets from one or more environments in one request, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| details (required) | BulkPublishDetails | Lists the entries, assets, locales, and environments. |
| skipWorkflowStage | bool | Adds skip_workflow_stage_check=true to the request. |
| approvals | bool | Adds approvals=true to the request. |
| isNested | bool | Adds nested=true and event_type=bulk to the request. |
| apiVersion | string? | Sends this value in the api_version header. |
Returns: Task<ContentstackResponse>. The API response with the bulk unpublish notice.
Validation
- Throws ArgumentNullException if details is null, because the details are the request body.
- The SDK throws the exceptions above when you call UnpublishAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like Unpublish.
Example
Warning UnpublishAsync removes every listed entry and asset from the environments you name. Content delivery requests to those environments stop returning them.
Basic usage: unpublish one entry from one environment
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
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 = 1, Locale = "<LOCALE_CODE>" }
},
Locales = new List<string> { "<LOCALE_CODE>" },
Environments = new List<string> { "<ENVIRONMENT_NAME>" }
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().UnpublishAsync(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}");
}All parameters: schedule a unpublish of entries and assets with nested references
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
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 = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().UnpublishAsync(
details,
skipWorkflowStage: true,
approvals: true,
isNested: true,
apiVersion: "3.2");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Update
Update changes the workflow stage, assignees, due date, and comment of many entries in one request.
| Name | Type | Description |
|---|---|---|
| updateBody (required) | BulkWorkflowUpdateBody | Lists the entries and the new workflow details. |
Returns: ContentstackResponse. The API response with the bulk workflow update notice.
Validation
- Throws ArgumentNullException (parameter body) if updateBody is null, because the body is the request. The SDK runs this check before the login check.
- The SDK does not check the stage UID, the entries, or the date format.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one POST request to /bulk/workflow, the Update workflow details in bulk request.
- Serializes BulkWorkflowUpdateBody as the JSON body and leaves out the properties that are null. workflow.notify is a bool, so the SDK always sends it.
- The Content Management API (CMA) reference changes the stage of many entries only when all of them sit at the same workflow stage of the same workflow.
- Returns the raw API response.
Example
Basic usage: move an entry to another workflow stage
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>");
BulkWorkflowUpdateBody body = new BulkWorkflowUpdateBody()
{
Entries = new List<BulkWorkflowEntry>
{
new BulkWorkflowEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
},
Workflow = new BulkWorkflowStage() { Uid = "<WORKFLOW_STAGE_UID>" }
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().Update(body);
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}");
}All parameters: assign users and roles with a due date and a notification
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkWorkflowUpdateBody body = new BulkWorkflowUpdateBody()
{
Entries = new List<BulkWorkflowEntry>
{
new BulkWorkflowEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" },
new BulkWorkflowEntry() { Uid = "<SECOND_ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
},
Workflow = new BulkWorkflowStage()
{
Uid = "<WORKFLOW_STAGE_UID>",
Comment = "Ready for legal review",
DueDate = "Thu Dec 10 2026",
Notify = true,
AssignedTo = new List<BulkWorkflowUser>
{
new BulkWorkflowUser() { Uid = "<USER_UID>", Name = "Alex Morgan", Email = "<EMAIL>" }
},
AssignedByRoles = new List<BulkWorkflowRole>
{
new BulkWorkflowRole() { Uid = "<ROLE_UID>", Name = "Legal Reviewer" }
}
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().Update(body);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}UpdateAsync
UpdateAsync changes the workflow stage, assignees, due date, and comment of many entries in one request, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| updateBody (required) | BulkWorkflowUpdateBody | Lists the entries and the new workflow details. |
Returns: Task<ContentstackResponse>. The API response with the bulk workflow update notice.
Validation
- Throws ArgumentNullException (parameter body) if updateBody is null, because the body is the request. The SDK runs this check before the login check.
- The SDK throws the exceptions above when you call UpdateAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like Update.
Example
Basic usage: move an entry to another workflow stage
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkWorkflowUpdateBody body = new BulkWorkflowUpdateBody()
{
Entries = new List<BulkWorkflowEntry>
{
new BulkWorkflowEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
},
Workflow = new BulkWorkflowStage() { Uid = "<WORKFLOW_STAGE_UID>" }
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().UpdateAsync(body);
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}");
}All parameters: assign users and roles with a due date and a notification
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkWorkflowUpdateBody body = new BulkWorkflowUpdateBody()
{
Entries = new List<BulkWorkflowEntry>
{
new BulkWorkflowEntry() { Uid = "<ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" },
new BulkWorkflowEntry() { Uid = "<SECOND_ENTRY_UID>", ContentType = "<CONTENT_TYPE_UID>", Locale = "<LOCALE_CODE>" }
},
Workflow = new BulkWorkflowStage()
{
Uid = "<WORKFLOW_STAGE_UID>",
Comment = "Ready for legal review",
DueDate = "Thu Dec 10 2026",
Notify = true,
AssignedTo = new List<BulkWorkflowUser>
{
new BulkWorkflowUser() { Uid = "<USER_UID>", Name = "Alex Morgan", Email = "<EMAIL>" }
},
AssignedByRoles = new List<BulkWorkflowRole>
{
new BulkWorkflowRole() { Uid = "<ROLE_UID>", Name = "Legal Reviewer" }
}
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().UpdateAsync(body);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}UpdateItems
UpdateItems sends a list of release items to the /bulk/release/update_items endpoint in one request.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Sets the release, action, locales, and items. |
| bulkVersion | string | Sends this value in the bulk_version header. |
Returns: ContentstackResponse. The API response with the bulk update-items notice.
Validation
- Throws ArgumentNullException if data is null, because the data is the request body.
- The SDK does not check bulkVersion or the items. An empty bulkVersion sends no bulk_version header.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Sends one PUT request to /bulk/release/update_items. The Content Management API (CMA) reference lists no request at this path.
- Serializes BulkAddItemsData as the JSON body and leaves out the properties that are null. Set Release and Action on data yourself, or call UpdateItemsWithDeployment, which sets them from its arguments.
- Sends bulkVersion as the bulk_version header, 1.0 when you omit it. The CMA reference documents no bulk_version value for this path. For the related Bulk Add to Release request, it requires 2.0.
- Returns the raw API response.
Example
Basic usage: send one entry for 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("<AUTHTOKEN>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().UpdateItems(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}");
}All parameters: send two entries with their references
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Reference = true,
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 2, Locale = "<LOCALE_CODE>", Title = "Spring Sale" },
new BulkAddItem() { Uid = "<SECOND_ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Summer Preview" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().UpdateItems(data, bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: omit bulkVersion and send the default 1.0 header
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>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
// Sends bulk_version: 1.0, the SDK default.
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().UpdateItems(data);
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}UpdateItemsAsync
UpdateItemsAsync sends a list of release items to the /bulk/release/update_items endpoint in one request, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Sets the release, action, locales, and items. |
| bulkVersion | string | Sends this value in the bulk_version header. |
Returns: Task<ContentstackResponse>. The API response with the bulk update-items notice.
Validation
- Throws ArgumentNullException if data is null, because the data is the request body.
- The SDK throws the exceptions above when you call UpdateItemsAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like UpdateItems.
Example
Basic usage: send one entry for a release
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().UpdateItemsAsync(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}");
}All parameters: send two entries with their references
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Reference = true,
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 2, Locale = "<LOCALE_CODE>", Title = "Spring Sale" },
new BulkAddItem() { Uid = "<SECOND_ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Summer Preview" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().UpdateItemsAsync(data, bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}UpdateItemsWithDeployment
UpdateItemsWithDeployment sets the release, action, locales, and reference flag on data, then calls the same endpoint as UpdateItems.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Holds the items. The method overwrites its release fields. |
| releaseUid (required) | string | Sets the UID of the target release. |
| action (required) | string | Sets the release action, publish or unpublish. |
| locales | List<string>? | Sets the locales of the release items. |
| reference | bool? | Includes the referenced items when true. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: ContentstackResponse. The API response with the bulk update-items notice.
Validation
- Throws NullReferenceException if data is null, because the method writes to data before the SDK checks it.
- The SDK does not check releaseUid, action, or locales. A null releaseUid or action leaves that key out of the body.
- Throws ContentstackErrorException when the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Writes releaseUid, action, locales, and reference to data.Release, data.Action, data.Locale, and data.Reference. These writes replace the values that data held, even when the argument is null, and they remain on data after the call.
- Then sends the same request as UpdateItems: one PUT request to /bulk/release/update_items.
- Sends bulkVersion as the bulk_version header only when it is not null or empty. With the default null, the request carries no bulk_version header. The Content Management API (CMA) reference documents no bulk_version value for this path.
- Returns the raw API response.
Example
Basic usage: send one entry for a release to publish
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>");
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>").BulkOperation().UpdateItemsWithDeployment(data, "<RELEASE_UID>", "publish", bulkVersion: "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}");
}All parameters: send items with locales and references
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().UpdateItemsWithDeployment(
data,
"<RELEASE_UID>",
"publish",
locales: new List<string> { "<LOCALE_CODE>" },
reference: true,
bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}Edge case: the method replaces the release fields on data
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>");
BulkAddItemsData data = new BulkAddItemsData()
{
Release = "<RELEASE_UID>",
Action = "publish",
Locale = new List<string> { "<LOCALE_CODE>" },
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
// data.Locale and data.Reference become null, because locales and reference are omitted.
client.Stack("<API_KEY>").BulkOperation().UpdateItemsWithDeployment(data, "<RELEASE_UID>", "unpublish", bulkVersion: "2.0");
Console.WriteLine($"{data.Action} {data.Locale == null}");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}UpdateItemsWithDeploymentAsync
UpdateItemsWithDeploymentAsync sets the release, action, locales, and reference flag on data, then calls the same endpoint as UpdateItems, without blocking the calling thread.
| Name | Type | Description |
|---|---|---|
| data (required) | BulkAddItemsData | Holds the items. The method overwrites its release fields. |
| releaseUid (required) | string | Sets the UID of the target release. |
| action (required) | string | Sets the release action, publish or unpublish. |
| locales | List<string>? | Sets the locales of the release items. |
| reference | bool? | Includes the referenced items when true. |
| bulkVersion | string? | Sends this value in the bulk_version header. |
Returns: Task<ContentstackResponse>. The API response with the bulk update-items notice.
Validation
- Throws NullReferenceException if data is null, because the method writes to data before the SDK checks it.
- The SDK throws the exceptions above when you call UpdateItemsWithDeploymentAsync, before it returns a task.
- Throws ContentstackErrorException when you await the task and the API rejects the request.
Additional Resource Refer to Content Management API Errors for the full error code list.
Behavior
- Behaves like UpdateItemsWithDeployment.
Example
Basic usage: send one entry for a release to publish
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>").BulkOperation().UpdateItemsWithDeploymentAsync(data, "<RELEASE_UID>", "publish", bulkVersion: "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}");
}All parameters: send items with locales and references
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();
BulkAddItemsData data = new BulkAddItemsData()
{
Items = new List<BulkAddItem>
{
new BulkAddItem() { Uid = "<ENTRY_UID>", ContentTypeUid = "<CONTENT_TYPE_UID>", Version = 1, Locale = "<LOCALE_CODE>", Title = "Spring Sale" }
}
};
try
{
ContentstackResponse response = await client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>").BulkOperation().UpdateItemsWithDeploymentAsync(
data,
"<RELEASE_UID>",
"publish",
locales: new List<string> { "<LOCALE_CODE>" },
reference: true,
bulkVersion: "2.0");
}
catch (ContentstackErrorException e)
{
Console.WriteLine(e.ErrorMessage);
}