Branches
Branches
Branches efficiently present independent workspaces where developers and content managers can work parallelly on content models and content. It helps sync the development activities of websites.
create
The create method creates a new branch in a particular stack of your organization.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | Data required to create a new branch |
import contentstack
import contentstack_management
data = {
"branch": {
"uid": "release",
"source": "main"
}
}
branch = contentstack_management.Client(authtoken='auth_token').stack(api_key='api_key').branch()
response = branch.create(data)delete
The delete method removes an existing branch from a particular stack of your organization.
| Name | Type | Description |
|---|---|---|
| branch_uid (required) | str | UID of the branch |
import contentstack import contentstack_management branch = contentstack_management.Client(authtoken='auth_token').stack(api_key='api_key').branch(branch_uid="branch_uid") response = branch.delete(data)
fetch
The fetch method retrieves the details of a specific branch.
| Name | Type | Description |
|---|---|---|
| branch_uid (required) | str | UID of the branch |
import contentstack import contentstack_management branch = contentstack_management.Client(authtoken='auth_token').stack(api_key='api_key').branch(branch_uid="branch_uid") response = branch.fetch()
find
The find method retrieves the details of all the branches in a particular branch.
| Name | Type | Description |
|---|---|---|
| limit (required) | Number | A limit on the number of objects to return |
| skip (required) | Number | The number of objects to skip before return |
| include_count (required) | Boolean | To retrieve the count of results in response |
import contentstack import contentstack_management branch = contentstack_management.Client(authtoken='auth_token').stack(api_key='api_key').branch() response = branch.find()