Aliases
An alias acts as a pointer to a particular branch. You can specify the alias ID in your frontend code to pull content from the target branch associated with an alias.
Get all aliases
https://api.contentstack.io/v3/stacks/branch_aliases?limit={limit_value}&skip={skip_value}&include_count={boolean_value}The Get all aliases request returns comprehensive information of all the aliases available in a particular stack in your account.
To configure the permissions for your application via OAuth, please include the cm.branch-aliases.management:read scope.
{
"branch_aliases": [
{
"uid": "development",
"source": "main",
"created_by": "blta7eaf6883dd73a0b",
"updated_by": "blta7eaf6883dd73a0b",
"created_at": "2021-07-26T10:16:07.248Z",
"updated_at": "2021-07-26T10:16:09.536Z",
"deleted_at": false,
"alias": "release"
},
{
"uid": "development",
"source": "main",
"created_by": "blta7eaf6883dd73a0b",
"updated_by": "blta7eaf6883dd73a0b",
"created_at": "2021-07-26T10:16:07.248Z",
"updated_at": "2021-07-26T10:16:09.536Z",
"deleted_at": false,
"alias": "dev"
},
{
"uid": "main",
"source": "",
"created_by": "blta7eaf6883dd73a0b",
"updated_by": "blta7eaf6883dd73a0b",
"created_at": "2021-07-26T10:04:20.752Z",
"updated_at": "2021-07-26T10:04:20.752Z",
"deleted_at": false,
"alias": "sample_alias"
}
]
}Get a single alias
https://api.contentstack.io/v3/stacks/branch_aliases/{branch_alias_uid}The Get a single alias request returns information of a specific alias.
To configure the permissions for your application via OAuth, please include the cm.branch-aliases.management:read scope.
{
"branch_alias": {
"uid": "dev",
"source": "main",
"created_by": "blta7eaf6883dd73a0b",
"updated_by": "blta7eaf6883dd73a0b",
"created_at": "2021-07-26T10:16:07.248Z",
"updated_at": "2021-07-26T10:16:09.536Z",
"deleted_at": false,
"alias": "sample_alias"
}
}Assign an alias
https://api.contentstack.io/v3/stacks/branch_aliases/{branch_alias_uid}The Assign an alias request creates a new alias in a particular stack of your organization. This alias can point to any existing branch (target branch) of your stack.
Note Only stack owners, admins, and developers can assign a new alias to a branch. You must only use the authtoken to assign an alias.
{
"branch_alias": {
"target_branch": "test"
}
}{
"notice": "Branch alias assigned successfully.",
"branch_alias": {
"uid": "test",
"source": "main",
"created_by": "blta7eaf6883dd73a0b",
"updated_by": "blta7eaf6883dd73a0b",
"created_at": "2021-07-27T12:45:39.690Z",
"updated_at": "2021-07-27T12:45:40.241Z",
"deleted_at": false,
"alias": "sample_alias"
}
}Delete an alias
https://api.contentstack.io/v3/stacks/branch_aliases/{branch_alias_uid}?force={boolean_value}The Delete an alias request deletes an existing alias.
To confirm the deletion of an alias, you need to specify the force=true query parameter.
When executing the API call, in the “URL Parameters” section, provide the UID of your alias.
NoteYou must only use the authtoken to delete an alias.
{
"notice": "Branch alias deleted successfully."
}