BranchAliasModel
BranchAliasModel
BranchAliasModel holds the UID of an alias that points to a branch.
When to Use This Class: Use this class to read which aliases point to a branch, from the Alias list of a fetched BranchModel.
Conceptual Role: Acts as the item type of BranchModel.Alias. The SDK has no class that creates, updates, or deletes an alias.
Returns: BranchAliasModel. The UID of one alias.
Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Uid | string? | No | null | Alias UID, for example production. Serialized as uid. |
Class-Level Notes
The API sets the alias list.
- The API sets the aliases of a branch. Assign or remove an alias through the Aliases requests of the Content Management API.
- The Content Management API (CMA) reference states that deleting a branch also deletes every alias that points to it.
Method Index
BranchAliasModel has no methods. Read its Uid property from the items of BranchModel.Alias.
Class-Level Snippet
This snippet fetches a branch and prints the UID of each alias that points to it.
using System;
using System.Text.Json;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;
ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
try
{
ContentstackResponse response = client.Stack("<API_KEY>").Branch("<BRANCH_UID>").Fetch();
BranchModel? branch = response.OpenJsonObjectResponse()["branch"]?.Deserialize<BranchModel>();
foreach (BranchAliasModel alias in branch?.Alias ?? new())
{
Console.WriteLine(alias.Uid);
}
}
catch (ContentstackErrorException e)
{
Console.WriteLine($"Request failed: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
}