BulkDeleteEntry

View as Markdown

BulkDeleteEntry

BulkDeleteEntry identifies one entry in a bulk delete request. Add it to BulkDeleteDetails.Entries before you call the Delete method.

When to Use This Class: Use this class once for each entry that a bulk delete request removes.

Conceptual Role: Acts as one object of the entries array in the request body.

Returns: BulkDeleteEntry. One entry of a bulk delete.

Properties

NameTypeRequiredDefaultDescription
Uidstring?NonullUID of the entry. Serialized as uid.
ContentTypestring?NonullUID of the content type of the entry. Serialized as content_type.
Localestring?NonullLocale code of the entry. Serialized as locale.

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.

Method Index

BulkDeleteEntry 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}");
}