Teams

View as Markdown

Teams

Teams streamline the process of assigning roles and permissions by grouping users together. Rather than assigning roles to individual users or at the stack level, you can assign roles directly to a team. This ensures that all users within a team share the same set of role permissions, making role management more efficient.

fetch

The fetch method retrieves details of a specific team.

NameTypeDescription
includeUserDetailsboolean

If true, include detailed user information for team members; otherwise, include only user UIDs.

import * as contentstack from '@contentstack/management'

const client = contentstack.client({ authtoken })


client.organization('organization_uid').teams('teamUid').fetch()

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

create

The create method creates a new team.

NameTypeDescription
includeUserDetailsboolean

If true, include detailed user information for team members; otherwise, include only user UIDs.

teamobject

Details required for team creation.

import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const team = { 
name: 'name', 
organizationUid: 'organization_uid', 
users: [], 
stackRoleMapping: [], 
organizationRole: 'organizationRole'
}

client.organization('organizationUid').teams().create(team)
.then((response) => console.log(response))

fetchAll

The fetchAll method retrieves the details of all teams.

NameTypeDescription
includeUserDetailsboolean

If true, include detailed user information for team members; otherwise, include only user UIDs.

asc|descstring

Sort in either ascending or descending order

typeaheadstring

Used to match the given string in all teams name & return the matched result

skipnumber

Skip the number of teams

limitnumber

Limit the result to number of teams

user_uidcomma separated string

list of user UIDs to be filtered

import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.organization('organizationUid').teams().fetchAll()
.then((teams) => console.log(teams))

delete

The delete method deletes an existing team.

import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.organization('organization_uid').teams('teamUid').delete()
.then((response) => console.log(response)

update

The update method involves adding and removing users from teams, assigning and removing stack roles within teams, updating team descriptions, and adjusting team organization roles.

NameTypeDescription
includeUserDetailsboolean

If true, include detailed user information for team members; otherwise, include only user UIDs.

import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const updateData = {
name: 'updatedname',
users: [{
email: '[email protected]'
}],
organizationRole: 'blt09e5dfced326aaea',
stackRoleMapping: []
}

client.organization(s'organizationUid').teams('teamUid').update(updateData)
.then((response) => console.log(response))

TeamUsers

The TeamUsers method retrieves the UIDs of the users.

import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.organization('organizationUid').teams('teamUid').teamUsers().fetchAll()
.then((response) => console.log(response))

stackRoleMappings

The stackRoleMappings method retrieves the stack role mapping details.

import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.organization(s'organizationUid').teams('teamUid').stackRoleMappings().fetchAll()
.then((response) => console.log(response))