BranchAlias

View as Markdown

BranchAlias

Branches efficiently present independent workspaces where developers and content managers can work parallely on content models and content. It helps sync the development activities of websites.

A branch alias is a custom name given to a specific branch in a stack to make referencing easier, especially when working with multiple branches.

createOrUpdate

The Create or Update BranchAlias call lets you update the name of an existing BranchAlias.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.stack({ api_key: 'api_key'})

.branchAlias('branch_alias_id')

.createOrUpdate('branch_uid')

.then((branch) => {

 branch.name = 'new_branch_name'

 return branch.update()

})

.then((branch) => console.log(branch))

delete

The Delete BranchAlias call is used to delete an existing BranchAlias permanently from your Stack.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.stack({ api_key: 'api_key'}).branchAlias('uid')

.delete()

.then((response) => console.log(response.notice))

fetch

The fetch BranchAlias call fetches BranchAlias details.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.stack({ api_key: 'api_key'}).branchAlias('branch_alias_id')

.fetch()

.then((branch) => console.log(branch))

fetchAll

The Get all BranchAlias request retrieves the details of all the Branch of a stack.

NameTypeDescription
params.limitnumber

The limit parameter will return a specific number of Branch in the output.

params.skipnumber

The skip parameter will skip a specific number of Branch in the output.

params.include_countboolean

To retrieve the count of Branch.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.stack({ api_key: 'api_key'}).branchAlias()

.fetchAll()

.then((collection) => console.log(collection))