Extension
Extension
Extensions let you create custom fields and custom widgets that lets you customize Contentstack's default UI and behavior. Read more about Extensions.
update
The Update Extension call lets you update an existing Extension.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).extension('extension_uid')
.fetch()
.then((extension) => {
extension.title = 'My Extension Type'
return extension.update()
})
.then((extension) => console.log(extension))delete
The Delete Extension call is used to delete an existing Extension permanently from your Stack.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).extension('extension_uid')
.delete()
.then((response) => console.log(response.notice))fetch
The fetch Extension call fetches Extension details.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).extension('extension_uid')
.fetch()
.then((extension) => console.log(extension))upload
The Upload is used to upload a new custom widget, custom field, dashboard Widget to a stack.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const extension = {
upload: 'path/to/file',
title: 'Title',
tags: [
'tag1',
'tag2'
],
data_type: 'text',
title: 'Old Extension',
multiple: false,
config: {},
type: 'Type of extenstion you want to create widget/dashboard/field'
}
client.stack({ api_key: 'api_key'}).extension().upload(extension)
.then((extension) => console.log(extension))create
The Create a extension call creates a new extension in a particular stack of your Contentstack account.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const extension = {
tags: [
'tag1',
'tag2'
],
data_type: 'text',
title: 'Old Extension',
src: "Enter either the source code (use 'srcdoc') or the external hosting link of the extension depending on the hosting method you selected.",
multiple: false,
config: {},
type: 'field'
}
client.stack({ api_key: 'api_key'}).extension().create({ extension })
.then((extension) => console.log(extension))query
The Query on extension will allow to fetch details of all or specific extensions.
| Name | Type | Description |
|---|---|---|
| params.include_count | boolean | Enter 'true' to include the count of extension |
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).extension()
.query()
.find()
.then((extensions) => console.log(extensions))