DeliveryToken

View as Markdown

DeliveryToken

Delivery tokens provide read-only access to the associated environments.

update

The update method allows you to modify the existing management token within the stack.

Example:

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).managementToken('management_token_uid')

.fetch()

.then((managementToken) => {

 managementToken.title = 'My New management token'

 managementToken.description = 'management token description'

 return managementToken.update()

})

.then((managementToken) => console.log(managementToken))

delete

The Delete DeliveryToken call is used to delete an existing DeliveryToken permanently from your Stack.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.stack({ api_key: 'api_key'}).deliveryToken('delivery_token_uid')

.delete()

.then((response) => console.log(response.notice))

fetch

The fetch DeliveryToken call fetches DeliveryToken details.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.stack({ api_key: 'api_key'}).deliveryToken('delivery_token_uid')

.fetch()

.then((deliveryToken) => console.log(deliveryToken))

create

The Create a DeliveryToken call creates a new deliveryToken in a particular stack of your Contentstack account.

NameTypeDescription
params.tokenobject

The token details with name, description and scope for the token to be created.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


const token = {

    name: 'Test',

    description: 'This is a demo token.',

    scope: [{

             module: 'environment',

             environments: ['development'],

             acl: {

               read: true

             }

           }]

}


client.stack({ api_key: 'api_key'}).deliveryToken()

.create({ token })

.then((deliveryToken) => console.log(deliveryToken))

query

The Query on Delivery Token will allow to fetch details of all or specific Delivery Token.

NameTypeDescription
params.include_countboolean

The `include_count’ parameter includes the count of total number of delivery token in your stack, along with the details of each delivery token

params.limitnumber

The ‘limit’ parameter will return a specific number of delivery token in the output.

params.skipnumber

The ‘skip’ parameter will skip a specific number of delivery token in the response.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.stack({ api_key: 'api_key'}).deliveryToken()

.query({ query: { name: 'token_name' } }))

.find()

.then((contentstackCollection) => console.log(contentstackCollection))