interface EnvironmentAlias {
    environment: {
        sys: MetaLinkProps;
    };
    sys: BasicMetaSysProps & {
        space: SysLink;
    };
    delete(): Promise<void>;
    toPlainObject(): EnvironmentAliasProps;
    update(): Promise<EnvironmentAlias>;
}

Hierarchy (view full)

Properties

environment: {
    sys: MetaLinkProps;
}
sys: BasicMetaSysProps & {
    space: SysLink;
}

System meta data

Methods

  • Deletes this object on the server.

    Returns Promise<void>

    Promise for the deletion. It contains no data, but the Promise error case should be handled.

    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) => {
    return alias.delete()
    })
    .then(() => console.log(`Alias deleted.`))
    .catch(console.error)

    EnvironmentAlias

    delete

  • 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.

    Returns Promise<EnvironmentAlias>

    Object returned from the server with updated changes.

    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)

    EnvironmentAlias

    update