Contentstack Management .NET SDK

View as Markdown

Overview

This reference covers the public API of the contentstack.management.csharp package, with one page per class. Use it to look up method signatures, parameters, return types, validation behavior, and worked examples for every object you reach from a ContentstackClient.

Before you begin This reference assumes you have installed and initialized the SDK. If you have not, complete the Get Started with .NET Management SDK guide first. This SDK requires .NET 10 or later, because the package targets net10.0. This reference documents version 1.2.0, and the changelog lists behavior changes between releases.

The command below adds the package to a project that targets .NET 10 or later:

dotnet add package contentstack.management.csharp

Minimum Working Example

This snippet creates a client with an authtoken, fetches one entry, and prints its title.

using System;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");

try
{
    ContentstackResponse response = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").FetchAsync();
    Console.WriteLine(response.OpenJsonObjectResponse()["entry"]?["title"]);
}
catch (ContentstackErrorException e)
{
    // Thrown when the API rejects the request
    Console.WriteLine($"Request failed: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
}

SDK Structure

The chain. The SDK builds each Content Management API (CMA) request from a chain of objects. ContentstackClient stores your credentials and settings, and client.Stack() returns a Stack for one stack. An accessor of the stack, such as ContentType, Asset, or Release, returns an object for one resource type. These calls send no request. A request method on the resource object sends one request: Fetch, Create, Update, Delete, or Publish, for example, or Query().Find() for a list. Every chain starts at the ContentstackClient.

Collection or item. The UID you pass to an accessor decides which methods you can call. Without a UID, the object works with the collection, for example Create or Query. With a UID, it works with one item, for example Fetch or Delete. A method from the other group throws InvalidOperationException before any request leaves the SDK. Query option methods, such as Limit and Skip, store a value and send nothing. An invalid value therefore fails on Find, which throws a ContentstackErrorException.

Sync and async. Each request method has a sync form that returns ContentstackResponse and an async form, with an Async suffix, that returns Task<ContentstackResponse>. The response contains the raw JSON body, which you read with OpenJsonObjectResponse() or OpenTResponse<T>().

Class Overview

Set up the client and sign in.

ClassRoleAccessed via
ContentstackClientThe connection settings and credentials, and the start of every chain.new ContentstackClient(...)
ContentstackClientOptionsEvery client setting in one object, including the host, timeout, proxy, and retries.new ContentstackClientOptions()
OAuthHandlerThe Open Authorization (OAuth) 2.0 authorization code flow of one app.client.OAuth(options)
OAuthOptionsThe settings of one OAuth app.new OAuthOptions()
OAuthTokensThe tokens and user details of one OAuth sign-in.oauth.GetCurrentTokens()
EndpointA static lookup of the Contentstack service hosts of a region.Endpoint.GetContentstackEndpoint(region, service)
OrganizationThe organizations of the signed-in user.client.Organization(uid)
UserThe password reset requests of a Contentstack account.client.User()

Send requests and read results.

ClassRoleAccessed via
ContentstackResponseThe HTTP response of one request, with its body and headers.entry.Fetch()
QueryA list request for one stack resource.contentType.Query()
ParameterCollectionThe query parameters of one request.new ParameterCollection()
BoolParameterValueA true or false query parameter value.new BoolParameterValue(true)
DoubleParameterValueA number query parameter value.new DoubleParameterValue(10)
DoubleListParameterValueA list of numbers for one query parameter.new DoubleListParameterValue(values)
StringParameterValueA text query parameter value.new StringParameterValue(value)
StringListParameterValueA list of text values for one query parameter.new StringListParameterValue(values)
JObjectParameterValueA JSON query parameter value.new JObjectParameterValue(json)

Handle errors.

ClassRoleAccessed via
ContentstackErrorExceptionThe exception for a request that the API rejects.catch (ContentstackErrorException e)
ContentstackExceptionThe base exception for errors that the SDK raises itself.catch (ContentstackException e)
OAuthExceptionThe exception for a failed OAuth step, with four subclasses.catch (OAuthException e)

Manage stacks, branches, environments, and languages.

ClassRoleAccessed via
StackOne stack, and the accessors for every stack resource.client.Stack(apiKey)
StackSettingsThe settings that AddSettings sends to a stack.new StackSettings()
UserInvitationOne user and the roles to give that user.new UserInvitation()
BranchThe branches of a stack.stack.Branch(uid)
BranchModelThe details of a branch.new BranchModel()
BranchAliasModelAn alias that points to a branch.branchModel.Alias
BranchPublishConfigModelThe environments that a new branch clones.new BranchPublishConfigModel()
EnvironmentThe publishing environments of a stack.stack.Environment(name)
EnvironmentModelThe details of a publishing environment.new EnvironmentModel()
ServerOne deployment server of a publishing environment.new Server()
LocalesUrlA language code and the URL that an environment serves it from.new LocalesUrl()
LocaleThe languages of a stack.stack.Locale(code)
LocaleModelThe details of a language.new LocaleModel()

Model content types and global fields.

ClassRoleAccessed via
ContentTypeThe content types of a stack.stack.ContentType(uid)
GlobalFieldThe global fields of a stack.stack.GlobalField(uid)
ContentModellingThe schema of a content type or a global field.new ContentModelling()
OptionThe page settings of a content type.new Option()
FieldThe base class of every field in a schema.contentModelling.Schema
TextboxFieldA text field.new TextboxField()
JsonFieldA JSON field, such as a JSON Rich Text Editor (JSON RTE).new JsonField()
NumberFieldA number field.new NumberField()
DateFieldA date field.new DateField()
FileFieldA file field.new FileField()
ImageFieldA file field that accepts only images.new ImageField()
SelectFieldA text field whose value comes from a fixed list of choices.new SelectField()
SelectEnumThe choices of a select field.new SelectEnum()
ReferenceFieldA reference field that links to entries of other content types.new ReferenceField()
GroupFieldA group field with a nested schema.new GroupField()
ModularBlockFieldA modular blocks field.new ModularBlockField()
BlockOne block type of a modular blocks field.new Block()
GlobalFieldReferenceA field that places a global field inside a schema.new GlobalFieldReference()
GlobalFieldRefsOne nested global field inside the schema of a global field.new GlobalFieldRefs()
ExtensionFieldA custom field that an extension renders.new ExtensionField()
TaxonomyFieldA taxonomy field.new TaxonomyField()
FieldMetadataThe extra settings of a field, such as a default value.new FieldMetadata()
FieldRulesOne field visibility rule of a content type.new FieldRules()
ConditionOne condition of a field visibility rule.new Condition()
ActionWhat a field visibility rule does to one target field.fieldRules.Actions
LabelThe labels that group content types.stack.Label(uid)
LabelModelThe details of a label.new LabelModel()

Work with entries.

ClassRoleAccessed via
EntryThe entries of one content type.contentType.Entry(uid)
EntryVariantThe variants of one entry.entry.Variant(uid)
VersionThe versions of one entry or asset.entry.Version(versionNumber)
VariantGroupThe variant groups of a stack.stack.VariantGroup(uid)
PublishUnpublishDetailsThe environments, locales, and schedule of a publish or unpublish request.new PublishUnpublishDetails()
PublishVariantOne entry variant in a publish or unpublish request.new PublishVariant()
EntryPublishActionThe publish rule details of a publish request.new EntryPublishAction()
EntryWorkflowStageThe workflow stage details of an entry.new EntryWorkflowStage()
AssignToUserOne user that a workflow stage assigns to an entry.new AssignToUser()
AssignByRoleOne role that a workflow stage assigns to an entry.new AssignByRole()

Work with assets.

ClassRoleAccessed via
AssetThe assets of a stack.stack.Asset(uid)
AssetModelThe file and details of an asset to upload.new AssetModel(...)
FolderThe asset folders of a stack.asset.Folder(uid)

Run bulk operations.

ClassRoleAccessed via
BulkOperationPublish, unpublish, delete, workflow, and release actions on many items in one request.stack.BulkOperation()
BulkPublishDetailsThe entries, assets, locales, and environments of a bulk publish or unpublish request.new BulkPublishDetails()
BulkPublishEntryOne entry in a bulk publish or unpublish request.new BulkPublishEntry()
BulkPublishAssetOne asset in a bulk publish or unpublish request.new BulkPublishAsset()
BulkPublishRulesThe rules object of a bulk publish or unpublish request.new BulkPublishRules()
BulkDeleteDetailsThe entries and assets of a bulk delete request.new BulkDeleteDetails()
BulkDeleteEntryOne entry in a bulk delete request.new BulkDeleteEntry()
BulkDeleteAssetOne asset in a bulk delete request.new BulkDeleteAsset()
BulkWorkflowUpdateBodyThe entries and new workflow details of a bulk workflow update.new BulkWorkflowUpdateBody()
BulkWorkflowEntryOne entry in a bulk workflow update.new BulkWorkflowEntry()
BulkWorkflowStageThe target stage and assignees of a bulk workflow update.new BulkWorkflowStage()
BulkWorkflowUserOne user to assign in a bulk workflow update.new BulkWorkflowUser()
BulkWorkflowRoleOne role to assign in a bulk workflow update.new BulkWorkflowRole()
BulkAddItemsDataThe release, action, locales, and items of a bulk release request.new BulkAddItemsData()
BulkAddItemOne entry or asset in a bulk release request.new BulkAddItem()
BulkReleaseItemsDataThe release, action, locales, and items of a bulk add-to-release request.new BulkReleaseItemsData()
BulkReleaseItemOne entry or asset in a bulk add-to-release request.new BulkReleaseItem()

Classify content with taxonomies.

ClassRoleAccessed via
TaxonomyThe taxonomies of a stack.stack.Taxonomy(uid)
TaxonomyModelThe details of a taxonomy.new TaxonomyModel()
TaxonomyImportModelA JSON or CSV taxonomy file to import.new TaxonomyImportModel(...)
TermThe terms of one taxonomy.taxonomy.Terms(uid)
TermModelThe details of a taxonomy term.new TermModel()
TermMoveModelThe target parent and position of a term to move.new TermMoveModel()
TermAncestorDescendantOne term above or below another term in a hierarchy.termModel.Ancestors

Plan and deploy releases.

ClassRoleAccessed via
ReleaseThe releases of a stack.stack.Release(uid)
ReleaseModelThe details of a release.new ReleaseModel()
ReleaseItemThe entries and assets of one release.release.Item()
ReleaseItemModelOne entry or asset in a release.new ReleaseItemModel()
DeployModelThe environments, locales, and action of a release deployment.new DeployModel()

Govern publishing.

ClassRoleAccessed via
WorkflowThe workflows of a stack.stack.Workflow(uid)
WorkflowModelThe details of a workflow.new WorkflowModel()
WorkflowStageOne stage of a workflow.new WorkflowStage()
PublishRuleThe publish rules of a stack.workflow.PublishRule(uid)
PublishRuleModelThe details of a publish rule.new PublishRuleModel()
ApprovalsThe users and roles who approve publishing under a publish rule.new Approvals()
PublishQueueThe publish queue of a stack.stack.PublishQueue(uid)
AuditLogThe audit log of a stack.stack.AuditLog(uid)

Extend the stack.

ClassRoleAccessed via
ExtensionThe extensions of a stack.stack.Extension(uid)
ExtensionModelThe title, type, source, and settings of an extension.new ExtensionModel()
ExtensionScopeThe content types whose entries show a custom widget.new ExtensionScope()
CustomFieldModelThe file and settings of a custom field to upload.new CustomFieldModel(...)
CustomWidgetModelThe file and settings of a custom widget to upload.new CustomWidgetModel(...)
DashboardWidgetModelThe file and settings of a dashboard widget to upload.new DashboardWidgetModel(...)
WebhookThe webhooks of a stack.stack.Webhook(uid)
WebhookModelThe details of a webhook.new WebhookModel()
WebhookTargetOne destination of a webhook.new WebhookTarget()

Manage roles and tokens.

ClassRoleAccessed via
RoleThe roles of a stack.stack.Role(uid)
RoleModelThe name, description, and rules of a role.new RoleModel()
DeliveryTokenThe delivery tokens of a stack.stack.DeliveryToken(uid)
DeliveryTokenModelThe details of a delivery token.new DeliveryTokenModel()
DeliveryTokenScopeOne scope entry of a delivery token.new DeliveryTokenScope()
ManagementTokenThe management tokens of a stack. See the Known issue on its class page.stack.ManagementTokens(uid)
ManagementTokenModelThe details of a management token.new ManagementTokenModel()
TokenScopeOne scope entry of a token.new TokenScope()
PreviewTokenThe preview token of one delivery token.stack.PreviewToken(deliveryTokenUid)
PreviewTokenModelThe name and description of a preview token.new PreviewTokenModel()

Task Index

TaskStart hereClass
Sign in with an email, a password, and a two-factor codeLoginContentstackClient
Sign users in through an OAuth appOAuthContentstackClient
Work in one branch with a management tokenStackContentstackClient
List the entries of a content typeQueryEntry
Paginate a listSkipQuery
Filter a list with a JSON queryAddQueryParameterCollection
Create an entryCreateEntry
Publish an entry to an environmentPublishEntry
Upload a file as an assetCreateAsset
Publish many entries and assets in one requestPublishBulkOperation
Read a response into your own classOpenTResponseContentstackResponse
Set the host, timeout, retries, or proxyContentstackClientOptionsContentstackClientOptions

Key Usage Patterns

Each example below is a complete C# file with every using directive it needs, so it compiles with implicit usings turned off. Run it as a top-level program.

Sign in with a two-factor code and list the stacks of an organization

When token is empty and mfaSecret has a value, LoginAsync generates the time-based one-time password (TOTP) from the secret. The client stores the authtoken from the response and sends it on every later request.

using System;
using System.Net;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;

ContentstackClient client = new ContentstackClient();

try
{
    await client.LoginAsync(new NetworkCredential("<EMAIL>", "<PASSWORD>"), mfaSecret: "<MFA_SECRET>");

    ContentstackResponse stacks = await client.Organization("<ORGANIZATION_UID>").GetStacksAsync();
    Console.WriteLine(stacks.OpenJsonObjectResponse().ToJsonString());

    await client.LogoutAsync();
}
catch (ContentstackErrorException e)
{
    Console.WriteLine(e.ErrorMessage);
}

Work in one branch with a management token

A management token belongs to one stack and needs no authtoken on the client. The SDK sends the branch UID as the branch header on every request from the Stack, including the requests of the objects its accessors return.

using System;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient();
Stack stack = client.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>", "<BRANCH_UID>");

try
{
    ContentstackResponse contentTypes = await stack.ContentType().Query().FindAsync();
    Console.WriteLine(contentTypes.OpenJsonObjectResponse().ToJsonString());

    ContentstackResponse entry = await stack.ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").FetchAsync();
    Console.WriteLine(entry.OpenJsonObjectResponse()["entry"]?["title"]);
}
catch (ContentstackErrorException e)
{
    Console.WriteLine(e.ErrorMessage);
}

Filter entries with query parameters and read them into your own class

ParameterCollection contains the parameters that a method has no argument for. OpenTResponse<T> maps the whole body onto your class, including the entries wrapper key. The following example filters entries by title and reads them into a typed class.

using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Queryable;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");

ParameterCollection collection = new ParameterCollection();
collection.Add("locale", "<LOCALE_CODE>");
collection.Add("include_count", true);
collection.AddQuery(new JsonObject { ["title"] = "Blog Post" });

try
{
    ContentstackResponse response = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry().Query().FindAsync(collection);
    EntriesResponse body = response.OpenTResponse<EntriesResponse>();

    Console.WriteLine($"{body?.Count} matching entries");
    foreach (BlogPost post in body?.Entries ?? new List<BlogPost>())
    {
        Console.WriteLine($"{post.Title}: {post.Url}");
    }
}
catch (ContentstackErrorException e)
{
    Console.WriteLine(e.ErrorMessage);
}

public class EntriesResponse
{
    public List<BlogPost> Entries { get; set; }
    public int Count { get; set; }
}

public class BlogPost
{
    public string Uid { get; set; }
    public string Title { get; set; }
    public string Url { get; set; }

    [JsonPropertyName("updated_at")]
    public DateTime UpdatedAt { get; set; }
}

Page through every entry of a content type

The SDK sends one request for each Find call and requests no further pages. Skip and Limit each take one value per query, so the loop below creates a new query for each page.

using System;
using System.Text.Json.Nodes;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
Stack stack = client.Stack("<API_KEY>");

const int pageSize = 100;
int skip = 0;
int received;

try
{
    do
    {
        ContentstackResponse response = await stack.ContentType("<CONTENT_TYPE_UID>").Entry().Query().Limit(pageSize).Skip(skip).FindAsync();
        JsonArray entries = response.OpenJsonObjectResponse()["entries"]?.AsArray() ?? new JsonArray();
        received = entries.Count;
        skip += received;
        Console.WriteLine($"Read {received} entries, {skip} in total");
    }
    while (received == pageSize);
}
catch (ContentstackErrorException e)
{
    Console.WriteLine(e.ErrorMessage);
}

Tell a client-side check, a network failure, and an API rejection apart

The SDK throws a different exception type for each of the three failures below:

  • A client-side check throws before any request.
  • A network failure throws the original .NET exception after the network retries end.
  • An API rejection throws ContentstackErrorException after the status retries end.

The following example catches each of the three exception types separately.

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");

try
{
    ContentstackResponse response = await client.Stack("<API_KEY>").ContentType("<CONTENT_TYPE_UID>").Entry("<ENTRY_UID>").FetchAsync();
    Console.WriteLine(response.OpenJsonObjectResponse().ToJsonString());
}
catch (InvalidOperationException e)
{
    // No authtoken or management token, no API key, or a method that the object's UID state does not allow
    Console.WriteLine($"Client-side check: {e.Message}");
}
catch (ArgumentException e)
{
    // A required UID or argument is missing
    Console.WriteLine($"Client-side check: {e.Message}");
}
catch (TaskCanceledException e)
{
    // Every attempt timed out
    Console.WriteLine($"Timed out: {e.Message}");
}
catch (HttpRequestException e)
{
    // A refused connection, an unreachable host, or a failed host name lookup
    Console.WriteLine($"Network failure: {e.Message}");
}
catch (ContentstackErrorException e)
{
    // The API answered with a status outside 2xx
    Console.WriteLine($"API error: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
    foreach (KeyValuePair<string, object> error in e.Errors ?? new Dictionary<string, object>())
    {
        Console.WriteLine($"{error.Key}: {error.Value}");
    }
}

Target another region with a longer timeout and bounded retries

The client has no region option, so set Host to the CMA host of the region. The retry settings below stop the client from retrying a 500 to 504 status without a limit. See the Known issue under SDK-Wide Notes below.

using System;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;

ContentstackClientOptions options = new ContentstackClientOptions()
{
    Authtoken = "<AUTHTOKEN>",
    Host = "eu-api.contentstack.com",
    Timeout = TimeSpan.FromSeconds(60),
    RetryLimit = 3,
    RetryDelay = TimeSpan.FromMilliseconds(500),
    RetryOnHttpServerError = false,
    RetryCondition = status => (int)status == 429
};

ContentstackClient client = new ContentstackClient(options);

try
{
    ContentstackResponse response = await client.Stack("<API_KEY>").FetchAsync();
    Console.WriteLine(response.OpenJsonObjectResponse().ToJsonString());
}
catch (ContentstackErrorException e)
{
    Console.WriteLine(e.ErrorMessage);
}

Register the client for dependency injection in `ASP.NET` Core

Known issue AddContentstackClient(services, options) and TryAddContentstackClient(services, options) from the contentstack.management.aspnetcore package register no ContentstackClient, so the container fails to resolve the client. Register the client yourself with services.AddSingleton(new ContentstackClient(options)), as in the file below.

The file below registers one client and a service class that receives it through its constructor. Give the client its own ContentstackClientOptions object, because the client writes the authtoken into it when you sign in or out.

using System.Threading.Tasks;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Microsoft.Extensions.DependencyInjection;

public static class ContentstackSetup
{
    // Call from Program.cs: ContentstackSetup.AddServices(builder.Services)
    public static void AddServices(IServiceCollection services)
    {
        ContentstackClientOptions options = new ContentstackClientOptions() { Authtoken = "<AUTHTOKEN>" };

        services.AddSingleton(new ContentstackClient(options));
        services.AddTransient<StackService>();
    }
}

// The container passes the registered ContentstackClient.
public class StackService
{
    private readonly ContentstackClient _client;

    public StackService(ContentstackClient client)
    {
        _client = client;
    }

    public async Task<string> GetStackJsonAsync(string apiKey)
    {
        try
        {
            ContentstackResponse response = await _client.Stack(apiKey).FetchAsync();
            return response.OpenJsonObjectResponse().ToJsonString();
        }
        catch (ContentstackErrorException e)
        {
            return e.ErrorMessage;
        }
    }
}

SDK-Wide Notes

ConcernBehaviorDefault when unset
AuthenticationThe client sends its authtoken as the authtoken header. Set it in the constructor, or call Login or LoginAsync to get one.No authtoken. Without an authtoken or a management token, the stack accessors throw InvalidOperationException before any request.
Two-factor sign-inLogin and LoginAsync send the two-factor authentication (2FA) code from token. When token is empty, the SDK generates the 2FA code from mfaSecret.null for both, so the request carries no 2FA code, and an account with 2FA turned on fails to sign in.
Management tokensclient.Stack("<API_KEY>", "<MANAGEMENT_TOKEN>") sends the token as the authorization header on every request from that stack, instead of the authtoken. Some CMA requests accept only an authtoken, and each method page says when.null, so the stack uses the client's authtoken.
OAuthclient.OAuth(options) returns an OAuthHandler. After the token exchange, the client sends authorization: Bearer <ACCESS_TOKEN> and refreshes the token before each async request when it expires in less than five minutes.Not applicable. The client uses an authtoken until an OAuth token exchange.
BranchesPass branchUid to client.Stack(). The SDK sends it as the branch header on every request from that stack.null, so the SDK sends no branch header.
Sync and async methodsEach request method has a sync form and an Async form. await the async form, because .Result or .Wait() wraps an API rejection in AggregateException, and a catch (ContentstackErrorException) block does not catch it.Not applicable. Both forms send the same request.
Error surfacingA status outside 2xx throws ContentstackErrorException with StatusCode, ErrorCode, ErrorMessage, and Errors. Client-side checks throw InvalidOperationException, ArgumentException, or ArgumentNullException before any request.Not applicable. A network failure throws the original .NET exception, such as TaskCanceledException or HttpRequestException.
ResponsesA returned ContentstackResponse always has a 2xx status. Read its raw JSON body with OpenJsonObjectResponse() or OpenTResponse<T>().Not applicable. The SDK never maps the body to a model by itself.
Query parametersPass a ParameterCollection to the collection argument of a request method. The SDK does not URL-encode its names or values, except for AddQuery.null, so the request carries no extra parameters.
Rate limiting and retryThis SDK automatically retries on 429 with configurable delay and attempt limits. It also retries 500 to 504 statuses and network failures, and it does not read the Retry-After header. See the ContentstackClientOptions class page.On. RetryLimit 5 with a RetryDelay of 300 milliseconds, and MaxNetworkRetries 3 with a NetworkRetryDelay of 100 milliseconds.
TimeoutsSet Timeout on ContentstackClientOptions as a TimeSpan, or pass timeout in seconds to the settings constructor. The timeout applies to each attempt.30 seconds.
Regions and endpointsThe client has no region option. Set Host to the CMA host of the region, for example eu-api.contentstack.com, and look up a host with the Endpoint class.api.contentstack.io, port 443, API version v3.
Proxy configurationSet ProxyHost, ProxyPort, and ProxyCredentials on ContentstackClientOptions. The SDK does not use them when you pass your own HttpClient.ProxyPort -1, so the client uses no proxy.
Client settingsThe constructor applies the timeout, proxy, and retry settings once, and the client writes Authtoken into its options object when you sign in or out. Create a new client to change a setting, and give each client its own options object.Not applicable.
JSONThe SDK reads and writes JSON with System.Text.Json only and leaves null model properties out of request bodies. Use [JsonPropertyName] when a property name differs from its JSON key.client.SerializerOptions, with case-insensitive names, null values skipped, and the SDK's converters.
LoggingThe client writes retry and error lines to the console. Set DisableLogging to true to turn them off.false, so the client logs to the console.
Dependency injectionRegister ContentstackClient in your ASP.NET Core container yourself. The registration methods of contentstack.management.aspnetcore register no client, as the Known issue in Key Usage Patterns above describes.Not applicable. Without a registration, create the client with a constructor.

Warning This SDK sends an authtoken, an OAuth access token, or a management token. Neither the constructor nor client.Stack() checks a token, so a delivery token or a preview token in their place fails at the first request with ContentstackErrorException. Refer to Content Management API Errors for the full error code list.

Known issue When the API keeps returning a 500 to 504 status, the client retries without a limit and the call never returns. Set RetryOnHttpServerError to false and RetryCondition to a function that leaves out 500 to 504, for example status => (int)status == 429, or set RetryOnError to false.

SDK Limitations

CapabilitySupportedNotes / Alternative
Select a region by nameNoSet Host to the region's CMA host. The Endpoint class looks up a region's hosts.
Honor the Retry-After headerNoSet RetryDelay or RetryDelayOptions.CustomBackoff to wait longer between retries.
Read every page of a list in one callNoCall Find once per page with a new query and a higher Skip value, as in Key Usage Patterns above.
Refresh an OAuth token before a sync requestNoUse async request methods, or call RefreshTokenAsync on the OAuthHandler.
Change a client setting after constructionNoCreate a new client with a new ContentstackClientOptions object.
Read or write Newtonsoft.Json typesNoUse System.Text.Json types. Refer to Migrate the .NET Management SDK from Newtonsoft.Json to System.Text.Json.
Log to a destination other than the consoleNoSet DisableLogging to true and log in your own code.