- Source:
Bulk operations such as Publish, Unpublish, and Delete on multiple entries or assets.
Methods
(static) publish() → {Promise.<Object>}
- Source:
The Publish entries and assets in bulk request allows you to publish multiple entries and assets at the same time.
Examples
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
const publishDetails = {
entries: [
{
uid: '{{entry_uid}}',
content_type: '{{content_type_uid}}',
version: '{{version}}',
locale: '{{entry_locale}}'
}
],
assets: [{
uid: '{{uid}}'
}],
locales: [
'en'
],
environments: [
'{{env_uid}}'
]
}
client.stack({ api_key: 'api_key'}).bulkOperation().publish({ details: publishDetails })
.then((response) => { console.log(response.notice) })
// Bulk nested publish
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
{
environments:["{{env_uid}}","{{env_uid}}"],
locales:["en-us"],
items:[
{
_content_type_uid: '{{content_type_uid}}',
uid: '{{entry_uid}}'
},
{
_content_type_uid: '{{content_type_uid}}',
uid: '{{entry_uid}}'
},
{
_content_type_uid: '{{content_type_uid}}',
uid: '{{entry_uid}}'
}
]
}
client.stack({ api_key: 'api_key'}).bulkOperation().publish({ details: publishDetails, is_nested: true })
.then((response) => { console.log(response.notice) })
Parameters:
Name | Type | Description |
---|---|---|
params.details |
Boolean | Set this with details containing 'entries', 'assets', 'locales', and 'environments' to which you want to publish the entries or assets. |
params.skip_workflow_stage_check |
Boolean | Set this to 'true' to publish the entries that are at a workflow stage where they satisfy the applied publish rules. |
params.approvals |
Boolean | Set this to 'true' to publish the entries that do not require an approval to be published. |
Returns:
Response Object.
- Type
- Promise.<Object>
(static) unpublish() → {Promise.<Object>}
- Source:
The Unpublish entries and assets in bulk request allows you to unpublish multiple entries and assets at the same time.
Examples
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
const publishDetails = {
entries: [
{
uid: '{{entry_uid}}',
content_type: '{{content_type_uid}}',
version: '{{version}}',
locale: '{{entry_locale}}'
}
],
assets: [{
uid: '{{uid}}'
}],
locales: [
'en'
],
environments: [
'{{env_uid}}'
]
}
client.stack({ api_key: 'api_key'}).bulkOperation().unpublish({ details: publishDetails })
.then((response) => { console.log(response.notice) })
// Bulk nested publish
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
{
environments:["{{env_uid}}","{{env_uid}}"],
locales:["en-us"],
items:[
{
_content_type_uid: '{{content_type_uid}}',
uid: '{{entry_uid}}'
},
{
_content_type_uid: '{{content_type_uid}}',
uid: '{{entry_uid}}'
},
{
_content_type_uid: '{{content_type_uid}}',
uid: '{{entry_uid}}'
}
]
}
client.stack({ api_key: 'api_key'}).bulkOperation().unpublish({ details: publishDetails, is_nested: true })
.then((response) => { console.log(response.notice) })
Parameters:
Name | Type | Description |
---|---|---|
params.details |
Boolean | Set this with details containing 'entries', 'assets', 'locales', and 'environments' to which you want to unpublish the entries or assets. If you do not specify a source locale, the entries or assets will be unpublished in the master locale automatically. |
params.skip_workflow_stage_check |
Boolean | Set this to 'true' to publish the entries that are at a workflow stage where they satisfy the applied publish rules. |
params.approvals |
Boolean | Set this to 'true' to publish the entries that do not require an approval to be published. |
Returns:
Response Object.
- Type
- Promise.<Object>
(static) delete() → {Promise.<String>}
- Source:
The Delete entries and assets in bulk request allows you to delete multiple entries and assets at the same time.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
const publishDetails = {
entries: [
{
uid: '{{entry_uid}}',
content_type: '{{content_type_uid}}',
locale: '{{entry_locale}}'
}
],
assets: [{
uid: '{{uid}}'
}]
}
client.stack({ api_key: 'api_key'}).bulkOperation().delete({ details: publishDetails })
.then((response) => { console.log(response.notice) })
Parameters:
Name | Type | Description |
---|---|---|
params.details |
Boolean | Set this with details specifing the content type UIDs, entry UIDs or asset UIDs, and locales of which the entries or assets you want to delete. |
Returns:
Success message
- Type
- Promise.<String>