Management Token

View as Markdown

Management Token

Management Tokens are tokens that provide you with read-write access to the content of your stack. It is a credential used along with the stack API key to make authorized Content Management API (CMA) requests for managing content of your stack.

create

The create method allows you to create a new management token in the stack.

NameTypeDescription
data (required)Dict

Data you want to send in the request body

"token":{
           "name":"Test Token",
           "description":"This is a sample management token.",
           "scope":[
               {
                   "module":"content_type",
                   "acl":{
                       "read":true,
                       "write":true
                   }
               },
               {
                   "module":"branch",
                   "branches":[
                       "main",
                       "development"
                   ],
                   "acl":{
                       "read":true
                   }
               },
               {
                   "module":"branch_alias",
                   "branch_aliases":[
                       "deploy",
                       "release"
                   ],
                   "acl":{
                       "read":true
                   }
               }
           ],
           "expires_on":"2020-12-10",
           "is_email_notification_enabled":true
       }
   }
import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').management_token().create(data).json()

delete

The delete method removes the existing management token from the stack.

NameTypeDescription
management_token_uid (required)str

UID of the management token

import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').management_token('management_token_uid').delete().json()

fetch

The fetch method retrieves the details of a specific management token from the stack.

NameTypeDescription
management_token_uid (required)str

UID of the management token

import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').management_token('management_token_uid').fetch().json()

find

The find method retrieves the details of all the management tokens created in the stack.

NameTypeDescription
management_token_uid (required)str

UID of the management token

import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack("api_key").management_token().find().json()

update

The update method allows you to make changes in the existing management token in the stack.

NameTypeDescription
data (required)Dict

The updated information for the management token

data = {
       "token":{
           "name":"Updated Test Token",
           "description":"This is an updated management token.",
           "scope":[
               {
                   "module":"content_type",
                   "acl":{
                       "read":true,
                       "write":true
                   }
               },
               {
                   "module":"entry",
                   "acl":{
                       "read":true,
                       "write":true
                   }
               },
               {
                   "module":"branch",
                   "branches":[
                       "main",
                       "development"
                   ],
                   "acl":{
                       "read":true
                   }
               },
               {
                   "module":"branch_alias",
                   "branch_aliases":[
                       "deploy"
                   ],
                   "acl":{
                       "read":true
                   }
               }
           ],
           "expires_on":"2020-12-31",
           "is_email_notification_enabled":true
       }
   }
import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').management_token("management_token_uid").update(data).json()