Stack

View as Markdown

Stack

A stack is a repository or a container that holds all the content/assets of your site. It allows multiple users to create, edit, approve, and publish their content within a single space.

The stack function initializes an instance of the “Stack”.

accept_ownership

The accept_ownership method allows the user to take control of the stack.

NameTypeDescription
user_uid (required)str

UID of the user

ownership_tokenstr

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

NameTypeDescription
asset_uidstr

UID of the asset

branchstr

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.

NameTypeDescription
log_item_uidstr

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.

NameTypeDescription
branch_uidstr

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.

NameTypeDescription
alias_uidstr

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.

NameTypeDescription
content_type_uidstr

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.

NameTypeDescription
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

NameTypeDescription
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.

NameTypeDescription
environment_namestr

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.

NameTypeDescription
global_field_uidstr

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.

NameTypeDescription
metadata_uidstr

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.

NameTypeDescription
dataDict

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.

NameTypeDescription
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.

NameTypeDescription
dataDict

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.

NameTypeDescription
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.

NameTypeDescription
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.

NameTypeDescription
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.

NameTypeDescription
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.

NameTypeDescription
webhook_uidstr

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.

NameTypeDescription
workflow_uidstr

UID of the workflow

import contentstack_management
client = contentstack_management.Client(authtoken='auth_token')

response = client.stack().workflows()