ContentstackClient
ContentstackClient
| Name | Type | Description |
|---|---|---|
| SerializerOptions | JsonSerializerOptions | Get and Set method for de-serialization. |
ContentstackClient
Initializes new instance of the Contentstack.Management.Core.ContentstackClient class.
| Name | Type | Description |
|---|---|---|
| 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);| Name | Type | Description |
|---|---|---|
| contentstackOptions | IOptions<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));| Name | Type | Description |
|---|---|---|
| authtoken | string | The optional Authtoken for making CMA call |
| host | string | The optional host name for the API. |
| port | int | The optional port for the API |
| version | string | The optional version for the API |
| disableLogging | bool | The optional to disable or enable logs. |
| maxResponseContentBufferSize | long | The optional maximum number of bytes to buffer when reading the response content |
| timeout | int | The optional timespan to wait before the request times out. |
| retryOnError | bool | The optional retry condition for retrying on error. |
| proxyHost | string | Host to use with a proxy. |
| proxyPort | int | Port to use with a proxy. |
| proxyCredentials | ICredentials | Credentials to use with a proxy. |
| EarlyAccess | string | 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| 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.
| Name | Type | Description |
|---|---|---|
| credentials (required) | ICredentials | User credentials used to authenticate the login request. |
| token | string | TOTP token generated from an authenticator app. Required for MFA-enabled users. |
| mfaSecret | string | 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.
| Name | Type | Description |
|---|---|---|
| credentials (required) | ICredentials | User credentials used to authenticate the login request. |
| token | string | TOTP token generated from an authenticator app. Required for MFA-enabled users. |
| mfaSecret | string | 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
| Name | Type | Description |
|---|---|---|
| authtoken | string | 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
| Name | Type | Description |
|---|---|---|
| authtoken | string | 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.
| Name | Type | Description |
|---|---|---|
| uid | string | 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.
| Name | Type | Description |
|---|---|---|
| apiKey | string | Stack API Key. |
| managementToken | string | Stack Management token |
| branchUid | string | 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();