Stack
Stack
accept_ownership
The accept_ownership method allows the user to take control of the stack.
| Name | Type | Description |
|---|---|---|
| user_uid (required) | str | UID of the user |
| ownership_token | str | The ownership token received via email by another user. |
import contentstack_management
client = contentstack.ContentstackClient(authtoken='the_authtoken')
response = client.stack('api_key').accept_ownership('user_id', 'ownership_token')assets
Assets refer to all the media files (images, videos, PDFs, audio files, and so on) uploaded in your Contentstack repository for future use. The assets method retrieves a specific asset in the stack
| Name | Type | Description |
|---|---|---|
| asset_uid | str | UID of the asset |
| branch | str | Branch where the asset is added |
import contentstack_management client = contentstack_management.Client(authtoken="auth_token") assets = client.stack(api_key).assets()
auditlog
A auditLog displays a record of all the activities performed in a stack and helps you keep a track of all published items, updates, deletes, and current status of the existing content.
| Name | Type | Description |
|---|---|---|
| log_item_uid | str | UID of the item |
import contentstack_management client = contentstack_management.Client(authtoken="auth_token") response = client.stack(api_key).auditlog()
branch
Branch corresponds to Stack branch.
| Name | Type | Description |
|---|---|---|
| branch_uid | str | UID of the branch |
import contentstack_management client = contentstack_management.Client(authtoken="auth_token") response = client.stack(api_key).branch()
branch_alias
Branch alias corresponds to the alias of that branch.
| Name | Type | Description |
|---|---|---|
| alias_uid | str | UID of the alias |
import contentstack_management client = contentstack_management.Client(authtoken="auth_token") response = client.stack(api_key).branch_alias()
content_types
Content type defines the structure or schema of a page or a section of your web or mobile property.
| Name | Type | Description |
|---|---|---|
| content_type_uid | str | UID of the content type |
import contentstack_management client = contentstack_management.Client(authtoken="auth_token") response = client.stack(api_key).content_types()
create
The create method creates a new stack.
| Name | Type | Description |
|---|---|---|
| organization_uid (required) | str | UID of the organization |
| data (required) | Dict | The request body. |
data = {
"stack": {
"name": "My New Stack",
"description": "My new test stack",
"master_locale": "en-us"
}
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack().create('organization_uid', data).json()create_settings
The create_settings method creates stack settings
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The request body. |
data = {
"stack_settings": {
"stack_variables": {
"enforce_unique_urls": 'true',
"sys_rte_allowed_tags": "style,figure,script",
"sys_rte_skip_format_on_paste": "GD:font-size"
},
"rte": {
"cs_only_breakline": 'true'
}
}
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').create_stack_settings(data).json()delete
The delete method deletes the stack from the organization.
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').delete()environment
The environment method retrieves the details of the environment added in the stack.
| Name | Type | Description |
|---|---|---|
| environment_name | str | Name of the environment |
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').environment()fetch
The fetch method retrieves the entries from the stack.
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').fetch()global_fields
Global field defines the structure or schema of a page or a section of your web or mobile property.
| Name | Type | Description |
|---|---|---|
| global_field_uid | str | UID of the global field |
import contentstack_management client = contentstack_management.Client(authtoken='auth_token') response = client.stack().global_field()
metadata
Metadata is a piece of information that lets you describe or classify an asset/entry. You can manage your digital entities effectively and facilitate enhanced accessibility with additional metadata.
| Name | Type | Description |
|---|---|---|
| metadata_uid | str | UID of the metadata |
import contentstack_management client = contentstack_management.Client(authtoken='auth_token') response = client.stack().metadata()
reset_settings
The reset_settings method resets the stack settings.
| Name | Type | Description |
|---|---|---|
| data | Dict | The request body. |
data = {
"stack_settings":{}
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').reset_stack_settings(data)roles
The roles method retrieves the details of the user roles in the stack.
| Name | Type | Description |
|---|---|---|
| roles_uid (required) | str | UID of the user role |
import contentstack_management client = contentstack_management.Client(authtoken='auth_token') response = client.stack().roles()
settings
The settings method retrieves the settings of the stack.
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').settings()share
The share method shares the stack with the users.
| Name | Type | Description |
|---|---|---|
| data | Dict | The request body |
data = {
"emails": [
"*****"
],
"roles": {
"[email protected]": [
"*******"
]
}
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').share_stack(data).json()transfer_ownership
The transfer_ownership method transfers the ownership of the stack to another user.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The request body |
data = {
"transfer_to": "[email protected]"
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').transfer_ownership(data)unshare
The unshare method removes access to a stack from users who have specific user roles.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The request body |
data = {
"email": "[email protected]"
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').unshare(data)update
The update method updates the stack entries.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The request body |
data = {
"stack": {
"name": "My New Stack",
"description": "My new test stack",
"master_locale": "en-us"
}
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').update(data).json()update_user_roles
The update_user_roles method updates all the user roles of the stack.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The request body |
data = {
"users": {
"user_uid": ["role_uid1", "role_uid2"]
}
}
import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')
response = client.stack('api_key').update_user_role(data)users
The users method retrieves the details of all the users of a stack.
import contentstack_management client = contentstack_management.Client(authtoken='auth_token') response = client.stack().users()
webhooks
A Webhook is a mechanism that sends real-time information to any third-party app or service to keep your application in sync with your Contentstack account.
| Name | Type | Description |
|---|---|---|
| webhook_uid | str | UID of the webhook |
import contentstack_management client = contentstack_management.Client(authtoken='auth_token') response = client.stack().webhooks()
workflows
A Workflow is a tool that allows you to streamline the process of content creation and publishing, and lets you manage the content lifecycle of your project smoothly.
| Name | Type | Description |
|---|---|---|
| workflow_uid | str | UID of the workflow |
import contentstack_management client = contentstack_management.Client(authtoken='auth_token') response = client.stack().workflows()