Metadata

View as Markdown

Metadata

Metadata is a piece of information that lets you describe or classify an asset/entry.

create

The create method allows you to create a new metadata for a specific entry or asset.

NameTypeDescription
data (required)Dict

Data you want to send in the request body

"metadata": {
           "entity_uid": "entity_uid",
           "type": "entry",
           "_content_type_uid": "sample_content",
           "extension_uid": "extension_uid",
           "presets": [{
               "uid": "presents_uid",
               "name": "Test1",
               "options": {
               }
           }]
       }
   }
import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').metadata().create(data).json()

delete

The delete method removes the metadata associated with a specific entry or asset.

NameTypeDescription
metadata_uid (required)str

UID of the metadata

import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').metadata('metadata_uid').delete().json()

fetch

The fetch method retrieves the details of the metadata attached to a specific asset or entry of a stack.

NameTypeDescription
metadata_uid (required)str

UID of the metadata

import contentstack_management
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').metadata('metadata_uid').fetch().json()

find

The find method retrieves the details of all the metadata attached to all the entries and assets in your stack.

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

publish

The publish method allows you to publish the metadata associated with a specific entry or asset.

NameTypeDescription
metadata_uid (required)str

UID of the metadata

"metadata": {
           "environments": [
           "test"
           ],
           "locales": [
           "en-us"
           ]
       }
       }
import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').metadata('metadata_uid').publish(data).json()

unpublish

The unpublish method allows you to unpublish the metadata associated with a specific entry or asset.

NameTypeDescription
metadata_uid (required)str

UID of the metadata

data = {
       "metadata": {
           "environments": [
           "test"
           ],
           "locales": [
           "en-us"
           ]
       }
       }
import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').metadata('metadata_uid').unpublish(data).json()

update

The update method allows you to make changes in the metadata for a specific entry or asset.

NameTypeDescription
data (required)Dict

The updated information for the metadata

data = {
       "metadata": {
           "entity_uid": "entity_uid",
           "type": "entry",
           "extension_uid": "extension_uid",
           "locale": "en_us",
           "_content_type_uid": "_content_type_uid",
           "presets": [{
                   "uid": "presets_uid",
                   "name": "test1",
                   "options": {}
               },
               {
                   "name": "Test3",
                   "uid": "presets_uid",
                   "options": {
                       "quality": "100",
                       "transform": {
                           "height": 500,
                           "width": 500
                       },
                       "image-type": "jpeg",
                       "focal-point": {
                           "x": 0,
                           "y": 0
                       }
                   }
               }
           ]
       }
   }
import contentstack_management 
client = contentstack_management.Client(authtoken='authtoken')
response = client.stack('api_key').metadata("metadata_uid").update(data).json()