- Source:
Methods
(static) login(parameters) → {Promise}
- Source:
Properties:
Name | Type | Description |
---|---|---|
parameters.email |
string | email id for user to login |
parameters.password |
string | password for user to login |
parameters.token |
string | token for user to login |
The login call is used to sign in to your Contentstack account and obtain the authtoken.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.login({ email: <emailid>, password: <password> })
.then(() => console.log('Logged in successfully'))
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | login parameters |
Returns:
- Type
- Promise
(static) getUser() → {Promise}
- Source:
The Get user 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.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.getUser()
.then((user) => console.log(user))
Returns:
- Type
- Promise
(static) stack(api_key, management_token, branch_name) → {Stack}
- Source:
Get Stack instance. A stack is a space that stores the content of a project.
Examples
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) => console.log(stack))
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.stack({ api_key: 'api_key'}).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' }).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) => console.log(stack))
Parameters:
Name | Type | Description |
---|---|---|
api_key |
String | Stack API Key |
management_token |
String | Management token for Stack. |
branch_name |
String | Branch name or alias to access specific branch. Default is master. |
Returns:
Instance of Stack
- Type
- Stack
(static) organization(uid) → {Organization}
- Source:
Organization is the top-level entity in the hierarchy of Contentstack, consisting of stacks and stack resources, and users.
Examples
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.organization().findAll()
.then((organization) => console.log(organization))
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.organization('org_uid').fetch()
.then((organization) => console.log(organization))
Parameters:
Name | Type | Description |
---|---|---|
uid |
String | Organization UID. |
Returns:
Instance of Organization.
- Type
- Organization
(static) logout(authtoken) → {Object}
- Source:
The Log out of your account call is used to sign out the user of Contentstack account.
Examples
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.logout()
.then((response) => console.log(response))
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
client.logout('AUTHTOKEN')
.then((response) => console.log(response))
Parameters:
Name | Type | Description |
---|---|---|
authtoken |
String | Authtoken to logout from. |
Returns:
Response object.
- Type
- Object