ContentstackClient
ContentstackClient
login
The login call is used to sign in to your Contentstack account and obtain the authtoken.
| Name | Type | Description |
|---|---|---|
| email (required) | string | email id for user to login |
| password (required) | string | password for user to login |
| token | string | token for user to login |
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.login({ email: <emailid>, password: <password> })
.then(() => {
}))getUser
The getUser call returns comprehensive information of an existing user account. The information returned includes details of the stacks owned by and shared with the specified user account.
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.getUser()
.then((user) => {
})logout
The logOut of your account call is used to sign out the user of Contentstack account.
| Name | Type | Description |
|---|---|---|
| authtoken | string | Authtoken to logout from. |
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.logout()
.then((response) => {
})import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.logout('AUTHTOKEN')
.then((response) => {
})stack
Get Stack instance. A stack is a space that stores the content of a project.
| Name | Type | Description |
|---|---|---|
| api_key (required) | string | Stack API Key |
| management_token | string | Management token for Stack. |
| branch_uid | string | Branch name or alias to access specific branch. |
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
const stack = {name: 'My New Stack'}
client.stack().create({ stack }, { organization_uid: 'org_uid' })
.then((stack) =>{
})import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.stack({ api_key: 'api_key'}).fetch()
.then((stack) => {
})import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.stack({ api_key: 'api_key', management_token: 'management_token'
})
.contentType('content_type_uid')
.fetch()
.then((stack) => console.log(stack))import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.stack({ api_key: 'api_key', management_token: 'management_token', branch_uid: 'branch_uid' })
.contentType('content_type_uid').fetch()
.then((stack) => {
})organization
Organization is the top-level entity in the hierarchy of Contentstack, consisting of stacks and stack resources, and users.
| Name | Type | Description |
|---|---|---|
| uid | string | Organization UID. |
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.organization().findAll()
.then((organization) => {
})import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.organization('org_uid').fetch()
.then((organization) => {
})