Environment
Environment
An environment allows users to publish their content on the destination URL. After you create an entry, you will publish it in 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 method adds a new publishing environment in your stack.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | Data required to create a new environment |
"environment": {
"name": "development",
"urls": [{
"locale": "en-us",
"url": "http://example.com/"
}]
}
}
import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').environments().create(data).json()delete
The delete method removes an existing environment from a particular stack of your organization.
| Name | Type | Description |
|---|---|---|
| environment_name (required) | str | Name of the environment you want to delete |
import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').environments('environment_name').delete().json()fetch
The fetch method retrieves the details of a specific environment from the stack.
| Name | Type | Description |
|---|---|---|
| environment_name (required) | str | Name of the environment you want to fetch |
import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').environments('environment_name').fetch().json()find
The find method retrieves the details of all the environments in a particular stack.
import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack("api_key").environments().find().json()update
The update method allows you to make changes in the existing environment for a stack.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The updated information for the environment |
data = {
"environment": {
"name": "development",
"urls": [{
"locale": "en-us",
"url": "http://example.com/"
}]
}
}
import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').environments("environment_name").update(data).json()