BulkDeleteDetails

View as Markdown

BulkDeleteDetails

BulkDeleteDetails lists the entries and assets of a bulk delete request. Pass it to the Delete method of BulkOperation.

When to Use This Class: Use this class to describe the items that one bulk delete request removes.

Conceptual Role: Acts as the JSON request body of the /bulk/delete request.

Returns: BulkDeleteDetails. The items of a bulk delete.

Properties

NameTypeRequiredDefaultDescription
EntriesList<BulkDeleteEntry>?NonullEntries to delete. Serialized as entries. See BulkDeleteEntry.
AssetsList<BulkDeleteAsset>?NonullAssets to delete. Serialized as assets. See BulkDeleteAsset.

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.

API limits.

  • The Content Management API (CMA) reference allows up to 100 entries in one bulk delete request. Split a larger list into several requests. See the Delete entries and assets in bulk request.

Method Index

BulkDeleteDetails has no methods. Set its properties and pass it as shown in the Class-Level Snippet below.

Class-Level Snippet

The snippet below deletes one entry and one asset 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("<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}");
}