Environment
Environment
An environment allows users to publish their content on the destination URL. After you create an entry, you will publish it on an environment. After publishing, you will see the content on your website’s URL (specified in the environment). Being not limited to a single environment, you can publish content on multiple environments too.
Create
The Create function will add a publishing environment for a stack.
| Name | Type | Description |
|---|---|---|
| model (required) | EnvironmentModel | Environment model for updating the environment. |
| collection | ParameterCollection | Query parameter collection |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EnvironmentModel model = new EnvironmentModel();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").Environment().Create(model);CreateAsync
The Create function will add a publishing environment for a stack.
| Name | Type | Description |
|---|---|---|
| model (required) | EnvironmentModel | Environment model for updating the environment. |
| collection | ParameterCollection | Query parameter collection |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EnvironmentModel model = new EnvironmentModel();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").Environment().CreateAsync(model);Delete
The Delete function will delete an existing publishing environment from your stack.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").Environment("<EXTENSION_UID>").Delete();DeleteAsync
The Delete function will delete an existing publishing environment from your stack.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").Environment("<EXTENSION_UID>").DeleteAsync();FetchAsync
The Fetch function returns more details about the specified environment of a stack.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").Environment("<EXTENSION_UID>").Fetch();FetchAsync
The Fetch function returns more details about the specified environment of a stack.
| Name | Type | Description |
|---|---|---|
| collection | ParameterCollection | Query parameter collection. |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").Environment("<EXTENSION_UID>").FetchAsync();Query
The Query on Environment function fetches the list of all environments available in a stack.
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
Query query = client.Stack("<API_KEY>").Environment().Query();Update
The Update function will update the details of an existing publishing environment for a stack.
| Name | Type | Description |
|---|---|---|
| model (required) | EnvironmentModel | Environment model for updating the environment. |
| collection | ParameterCollection | Query parameter collection |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EnvironmentModel model = new EnvironmentModel();
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").Environment("<ENVIRONMENT_UID>").Update(model);UpdateAsync
The Update function will update the details of an existing publishing environment for a stack.
| Name | Type | Description |
|---|---|---|
| model (required) | EnvironmentModel | Environment model for updating the environment. |
| collection | ParameterCollection | Query parameter collection |
using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
EnvironmentModel model = new EnvironmentModel();
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").Environment("<ENVIRONMENT_UID>").UpdateAsync(model);