Entry
Entry
An entry is the actual piece of content created using one of the defined content types. Read more about Entries.
create
The create method creates a new entry for the selected content type in a particular stack.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The content of the new entry that you want to create. |
data = {
"global_field": {
"title": "Servlet",
"uid": "servlet",
"schema": [{
"display_ndata = {
"entry": {
"title": "example",
"url": "/example"
}
}
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types().entry().create(data).json()delete
The delete method deletes an existing entry for the selected content type in a particular stack.
| Name | Type | Description |
|---|---|---|
| entry_uid (required) | str | UID of the entry |
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').delete().json()export
The export method exports an existing entry in a JSON format.
| Name | Type | Description |
|---|---|---|
| entry_uid (required) | str | UID of the entry |
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types(''content_type_uid'').entry('entry_uid').export().json()fetch
The fetch method retrieves the details of an existing entry.
| Name | Type | Description |
|---|---|---|
| entry_uid (required) | str | UID of the entry |
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').fetch().json()find
The find method retrieves the details of all existing entries.
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack("api_key").content_types('content_type_uid').entry().find().json()addParam
The addParam method adds a parameter to the request.
| Name | Type | Description |
|---|---|---|
| key (required) | str | Query parameter key for the request |
| value (required) | str/int | Query parameter value for the request |
Example 1:
import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
query = client.stack('api_key').content_types('content_type_uid').entry()
query.add_param("limit", 2)
result = query.find()Example 2:
import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
query = client.stack('api_key').content_types('content_type_uid').entry()
query.add_param("skip", 2)
result = query.find()addParam with Dictionary
The addParam with Dictionary method adds multiple parameters to the request.
| Name | Type | Description |
|---|---|---|
| testdict (required) | dict | Query parameter dictionary for the request |
Example:
import contentstack_management
testdict = {
"limit": 2,
"skip": 2,
"include_branch": True
}
client = contentstack_management.Client(authtoken='your_authtoken')
query = client.stack('api_key').content_types('content_type_uid').entry()
query.add_param_dict(testdict)
result = query.find()addHeader
The addHeader method adds a header to the request.
| Name | Type | Description |
|---|---|---|
| key (required) | str | Header key for the request |
| value (required) | obj | Header value for the request |
Example:
import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
query = client.stack('api_key').content_types('content_type_uid').entry()
query.add_header("branch", "branch_uid")
result = query.find()addHeader with Dictionary
The addHeader with Dictionary method adds multiple headers to the request.
| Name | Type | Description |
|---|---|---|
| testdict (required) | dict | Query parameter dictionary for the request |
Example:
import contentstack_management
testdict = {
"branch": "branch_uid"
}
client = contentstack_management.Client(authtoken='your_authtoken')
query = client.stack('api_key').content_types('content_type_uid').entry()
query.add_header_dict(testdict)
result = query.find()import
The import method imports the entries in the JSON.
| Name | Type | Description |
|---|---|---|
| entry_uid (required) | str | UID of the entry |
| file_path (required) | str | The file path of the file you want to import |
| locale | str | The language for the entry. Set to en-us by default |
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
file_path = "tests/resources/mock_content_types/import_content_types.json"
response = client.stack('api_key').content_types().entry('entry_uid').imports(file_path).json()language
The languages method retrieves the details of all the languages that an entry exists in.
| Name | Type | Description |
|---|---|---|
| entry_uid (required) | str | UID of the entry |
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').languages().json()publish
The publish method allows you to publish an entry for a specified environment either immediately or schedule it for a later date/time.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The data you want to publish |
data = {
"entry": {
"environments": ["development"],
"locales": ["en-us"]
},
"locale": "en-us",
"version": 1,
"scheduled_at": "2019-02-14T18:30:00.000Z"
}
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types().entry('entry_uid').publish(data).json()localize
The localize method will allow you to localize an entry, i.e., the entry will cease to retrieve the data from the fallback language and possess an independent content specific to the selected locale.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | Fields and values that you want to add or update for the specified locale |
| locale (required) | str | The language for the entry. Set to en-us by default |
data ={
"entry": {
"title": "Home",
"url": "/home-french",
"tags": [],
"locale": "en-us",
"uid": "entry_uid",
"created_by": "user_uid",
"updated_by": "user_uid",
"created_at": "2017-06-13T12:34:52.083Z",
"updated_at": "2018-12-28T06:33:06.752Z",
"ACL": {},
"_version": 2
}
}
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').localize(data).json()references
The references method retrieves the details of all the entries referenced by a particular entry.
| Name | Type | Description |
|---|---|---|
| entry_uid (required) | str | UID of the entry |
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').references().json()unlocalize
The unlocalize method will allow you to unlocalize an existing entry, i.e., the entry will retrieve the data from the fallback language.
| Name | Type | Description |
|---|---|---|
| locale (required) | str | The language for the entry. Set to en-us by default. |
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').unlocalize().json()unpublish
The unpublish method allows you to unpublish an entry for a specified environment either immediately or schedule it for a later date/time.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The content type UID and any additional data required for the unpublishing process |
data = {
"entry": {
"environments": ["development"],
"locales": ["en-us"]
},
"locale": "en-us",
"version": 1,
"scheduled_at": "2019-02-14T18:30:00.000Z"
}
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types().entry('entry_uid').unpublish().json()update
The update method allows you to make changes in the contents of an existing entry.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The content type UID and any additional data required for the unpublishing process |
| locale (required) | str | The language for the entry. Set to en-us by default. |
data = {
"entry": {
"title": "example",
"url": "/example"
}
}
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').update(data).json()version_naming
The version_naming method allows you to assign a name to a specific version of an entry.
| Name | Type | Description |
|---|---|---|
| data (required) | Dict | The information you want to send to the server |
| version_number (required) | str | The identifier to a specific version of an entry. |
data ={
"entry": {
"_version_name": "Test version",
"locale": "en-us",
"force": true
}
}
import contentstack_management
client = contentstack_management.Client(authtoken="authtoken")
response = client.stack('api_key').content_types('content_type_uid').entry('entry_uid').version_naming(data).json()