- Source:
Environment aliases allow environments to be accessed through another identifier. You must have a V2 org and manually opt-in to this feature from the
environments settings page in the Contentful web app. If you do not have access to this feature, these methods will return 403 errors.
Type Definitions
EnvironmentAlias
- Source:
Properties:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
sys |
Object | System metadata
Properties
|
|||||||||
environment |
Environment | the environment this alias points to | |||||||||
toPlainObject() |
function | Returns this EnvironmentAlias as a plain JS object |
EnvironmentAliasCollection
- Source:
Properties:
Name | Type | Description |
---|---|---|
total |
number | |
skip |
number | |
limit |
number | |
items |
Array.<EnvironmentAlias.EnvironmentAlias> | |
toPlainObject() |
function | Returns this EnvironmentAlias collection as a plain JS object |
Methods
(static) update() → {Promise.<EnvironmentAlias>}
- Source:
Sends an update to the server with any changes made to the object's properties. Currently, you can only change the id of the alias's underlying environment. See the example below.
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getSpace('<space_id>')
.then((space) => space.getEnvironmentAlias('<environment_alias_id>'))
.then((alias) => {
alias.environment.sys.id = '<environment_id>'
return alias.update()
})
.then((alias) => console.log(`alias ${alias.sys.id} updated.`))
.catch(console.error)
Returns:
Object returned from the server with updated changes.
- Type
- Promise.<EnvironmentAlias>