ContentstackClient

View as Markdown

ContentstackClient

Contentstack Client for interacting with Contentstack Management API.
NameTypeDescription
SerializerOptions JsonSerializerOptions

Get and Set method for de-serialization.

ContentstackClient

Initializes new instance of the Contentstack.Management.Core.ContentstackClient class.

NameTypeDescription
contentstackOptions (required)ContentstackClientOptions

Contentstack configuration options.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


var options = new ContentstackClientOptions()

{

      Host = "<API_HOST>",

      Authtoken = "<AUTHTOKEN>"

}

ContentstackClient client = new ContentstackClient(options);
NameTypeDescription
contentstackOptionsIOptions<ContentstackClientOptions>

Contentstack configuration options.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


var options = new ContentstackClientOptions()

{

      Host = "<API_HOST>",

      Authtoken = "<AUTHTOKEN>"

}

ContentstackClient client = new ContentstackClient(new OptionsWrapper<ContentstackClientOptions>

(options));

NameTypeDescription
authtokenstring

The optional Authtoken for making CMA call

host string

The optional host name for the API.

Default: api.contentstack.io
portint

The optional port for the API

Default: 443
versionstring

The optional version for the API

Default: v3
disableLoggingbool

The optional to disable or enable logs.

Default: false
maxResponseContentBufferSizelong

The optional maximum number of bytes to buffer when reading the response content

Default: 1073741824L
timeoutint

The optional timespan to wait before the request times out.

Default: 30 sec
retryOnErrorbool

The optional retry condition for retrying on error.

Default: true
proxyHoststring

Host to use with a proxy.

proxyPortint

Port to use with a proxy.

Default: -1
proxyCredentialsICredentials

Credentials to use with a proxy.

EarlyAccessstring

Optional array of header strings for early access features.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


ContentstackClient client = new ContentstackClient("AUTHTOKEN");

GetUser

The Get user call returns comprehensive information of an existing user account.

NameTypeDescription
collection (required)ParameterCollection

Query parameter collection.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


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

ContentstackResponse contentstackResponse = client.GetUser();

GetUserAsync

The Get user call returns comprehensive information of an existing user account.

NameTypeDescription
collection (required)ParameterCollection

Query parameter collection.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


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

ContentstackResponse contentstackResponse = await client.GetUserAsync();

Login

The Log in to your account request is used to sign in to your Contentstack account and obtain the authtoken. Refer to the TOTP Support for .NET Management SDK for more information.

NameTypeDescription
credentials (required)ICredentials

User credentials used to authenticate the login request.

tokenstring

TOTP token generated from an authenticator app. Required for MFA-enabled users.

mfaSecretstring

Secret key generated when the user enables MFA in Contentstack. Used to dynamically create a TOTP token.

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();

NetworkCredential credentials = new NetworkCredential("<EMAIL>", "<PASSWORD>");

// Login when MFA is not enabled for the user 
ContentstackResponse contentstackResponse = client.Login(credentials);

// Login when MFA is enabled: use a valid TOTP token generated from an authenticator app
string tfa_token = "<my_tfa_token>";
contentstackResponse = client.Login(credentials, token = tfa_token);

// Login using the MFA secret: SDK will generate the TOTP token dynamically
string mfa_secret = "<my_mfa_secret>";
contentstackResponse = client.Login(credentials, mfaSecret = mfa_secret);

LoginAsync

The Log in to your account request is used to sign in to your Contentstack account and obtain the authtoken. Refer to the TOTP Support for .NET Management SDK for more information.

NameTypeDescription
credentials (required)ICredentials

User credentials used to authenticate the login request.

tokenstring

TOTP token generated from an authenticator app. Required for MFA-enabled users.

mfaSecretstring

Secret key generated when the user enables MFA in Contentstack. Used to dynamically create a TOTP token.

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient();

NetworkCredential credentials = new NetworkCredential("<EMAIL>", "<PASSWORD>");

// Login when MFA is not enabled for the user
ContentstackResponse contentstackResponse = await client.Login(credentials);

// Login when MFA is enabled: use a valid TOTP token generated from an authenticator app
string tfa_token = "<my_tfa_token>";
contentstackResponse = await client.Login(credentials, token = tfa_token);

// Login using the MFA secret: SDK will generate the TOTP token dynamically
string mfa_secret = "<my_mfa_secret>";
contentstackResponse = await client.Login(credentials, mfaSecret = mfa_secret);

Logout

The Log out of your account call is used to sign out the user of Contentstack account

NameTypeDescription
authtokenstring

The optional auth token in case the user wants to logout.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


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

ContentstackResponse contentstackResponse = client.Logout();

LogoutAsync

The Log out of your account call is used to sign out the user of Contentstack account

NameTypeDescription
authtokenstring

The optional authroken in case user want to logout.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


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

ContentstackResponse contentstackResponse = await client.LogoutAsync();

Organization

Organization the top-level entity in the hierarchy of Contentstack, consisting of stacks and stack resources, and users. Organization allows easy management of projects as well as users within the Organization.

NameTypeDescription
uidstring

Organization uid for specific org.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


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

Organization organization = client.Organization();

Stack

Stack is a space that stores the content of a project (a web or mobile property). Within a stack, you can create content structures, content entries, users, etc. related to the project.

NameTypeDescription
apiKeystring

Stack API Key.

managementTokenstring

Stack Management token

branchUidstring

Branch uid for querying specific branch of stack.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


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

Stack Stack = client.Stack("<API_KEY>");

User

User session consists of calls that will help you to update user of your Contentstack account.

using Contentstack.Management.Core;

using Contentstack.Management.Core.Models;


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

User user = client.User();