Labels

View as Markdown

Labels

Labels allow you to group a collection of content within a stack. Using labels you can group content types that need to work together. Read more about Labels.

find

The find method retrieves all the existing labels of the stack.


import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack("api_key").label().find().json()

fetch

The fetch method retrieves information about a particular label of a stack.



NameTypeDescription
label_uid (required)str

UID of the Label

import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').label(label_uid).fetch().json()

create

The Create method creates a new label.

NameTypeDescription
data (required)dict

Data required to create a new label

data = {
"label": {
"name": "Test",
"parent": [
"label_uid"
],
"content_types": [
"content_type_uid"
]
}
}

import contentstack_management 
client = contentstack_management.Client(authtoken='your_authtoken')
response = client.stack('api_key').label().create(data).json()

update

The Update method is used to update an existing label.

NameTypeDescription
data (required)dict

The updated data of the label

label_uid (required)str

UID of the label

data ={
  "label": {
    "name": "Test",
    "parent": [
      "label_uid"
    ],
    "content_types": [
      "content_type_uid"
    ]
  }
}

import contentstack_management 
client = contentstack_management.Client(authtoken='your_authtoken')
response = client.stack('api_key').label("label_uid").update(data).json()

Delete

The Delete method is used to remove a specific label from the stack.

NameTypeDescription
label_uid (required)str

UID of the label

import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').label('label_uid').delete().json()