- Source:
Contentful Organization API. Contains methods to access any operations at a organization level.
Type Definitions
ContentfulOrganizationAPI
- Source:
Properties:
Name | Type | Description |
---|---|---|
createAppDefinition |
function | |
getAppDefinition |
function | |
getAppDefinitions |
function | |
getUser |
function | |
getUsers |
function | |
getOrganizationMembership |
function | |
getOrganizationMemberships |
function | |
createTeam |
function | |
getTeam |
function | |
getTeams |
function | |
createTeamMembership |
function | |
getTeamMembership |
function | |
getTeamMemberships |
function | |
getTeamSpaceMembership |
function | |
getTeamSpaceMemberships |
function | |
getOrganizationInvitation |
function | |
createOrganizationInvitation |
function |
Type:
- object
Methods
(static) createAppDefinition(dataopt) → {Promise.<AppDefinition.AppDefinition>}
- Source:
- See:
Creates an app definition
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getOrganization('<org_id>')
.then((org) => org.createAppDefinition({
name: 'Example app',
locations: [{ location: 'app-config' }],
src: "http://my-app-host.com/my-app"
}))
.then((appDefinition) => console.log(appDefinition))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
object |
<optional> |
Object representation of the App Definition to be created |
Returns:
Promise for the newly created AppDefinition
- Type
- Promise.<AppDefinition.AppDefinition>
(static) createOrganizationInvitation(id) → {Promise.<OrganizationInvitation>}
- Source:
Create an Invitation in Organization
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getOrganization('<org_id>')
.then((organization) => organization.createOrganizationInvitation({
email: 'user.email@example.com'
firstName: 'User First Name'
lastName: 'User Last Name'
role: 'developer'
})
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Invitation ID |
Returns:
Promise for a OrganizationInvitation in an organization
- Type
- Promise.<OrganizationInvitation>
(static) createTeam(dataopt) → {Promise.<TeamMembership.TeamMembership>}
- Source:
- See:
-
- {Team}
Creates a Team
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getOrganization('<org_id>')
.then((org) => org.createTeam({
name: 'new team',
description: 'new team description'
}))
.then((team) => console.log(team))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
object |
<optional> |
Object representation of the Team to be created |
Returns:
Promise for the newly created Team
- Type
- Promise.<TeamMembership.TeamMembership>
(static) createTeamMembership(dataopt) → {Promise.<TeamMembership.TeamMembership>}
- Source:
- See:
Creates a Team membership
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getOrganization('organizationId')
.then((org) => org.createTeamMembership('teamId', {
admin: true,
organizationMembershipId: "3ugleZJgHKk89I1P5MSDuY"
}))
.then((teamMembership) => console.log(teamMembership))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
object |
<optional> |
Object representation of the Team Membership to be created |
Returns:
Promise for the newly created TeamMembership
- Type
- Promise.<TeamMembership.TeamMembership>
(static) getAppDefinition() → {Promise.<AppDefinition.AppDefinition>}
- Source:
Gets an app definition
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getOrganization('<org_id>')
.then((org) => org.getAppDefinition('<app_definition_id>'))
.then((appDefinition) => console.log(appDefinition))
.catch(console.error)
Returns:
Promise for an App Definition
- Type
- Promise.<AppDefinition.AppDefinition>
(static) getAppDefinitions() → {Promise.<AppDefinition.AppDefinitionCollection>}
- Source:
Gets all app definitions
Example
const contentful = require('contentful-management')
const client = contentful.createClient({
accessToken: '<content_management_api_key>'
})
client.getOrganization('<org_id>')
.then((org) => org.getAppDefinitions())
.then((response) => console.log(response.items))
.catch(console.error)
Returns:
Promise for a collection of App Definitions
- Type
- Promise.<AppDefinition.AppDefinitionCollection>
(static) getOrganizationInvitation(id) → {Promise.<OrganizationInvitation>}
- Source:
Gets an Invitation in Organization
Example
const contentful = require('contentful-management')
client.getOrganization('<org_id>')
.then((organization) => organization.getOrganizationInvitation('invitation_id'))
.then((invitation) => console.log(invitation))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Invitation ID |
Returns:
Promise for a OrganizationInvitation in an organization
- Type
- Promise.<OrganizationInvitation>
(static) getOrganizationMembership(id) → {Promise.<OrganizationMembership.OrganizationMembership>}
- Source:
Gets an Organization Membership
Example
const contentful = require('contentful-management')
client.getOrganization('organization_id')
.then((organization) => organization.getOrganizationMembership('organizationMembership_id'))
.then((organizationMembership) => console.log(organizationMembership))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Organization Membership ID |
Returns:
Promise for an Organization Membership
- Type
- Promise.<OrganizationMembership.OrganizationMembership>
(static) getOrganizationMemberships(queryopt) → {Promise.<OrganizationMembership.OrganizationMembershipCollection>}
- Source:
Gets a collection of Organization Memberships
Example
const contentful = require('contentful-management')
client.getOrganization('organization_id')
.then((organization) => organization.getOrganizationMemberships({'limit': 100})) // you can add more queries as 'key': 'value'
.then((response) => console.log(response.items))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
object |
<optional> |
Object with search parameters. Check the JS SDK tutorial and the REST API reference for more details. |
Returns:
Promise for a collection of Organization Memberships
- Type
- Promise.<OrganizationMembership.OrganizationMembershipCollection>
(static) getOrganizationSpaceMembership(id) → {Promise.<SpaceMembership>}
- Source:
Gets an Space Membership in Organization
Example
const contentful = require('contentful-management')
client.getOrganization('organization_id')
.then((organization) => organization.getOrganizationSpaceMembership('organizationSpaceMembership_id'))
.then((organizationMembership) => console.log(organizationMembership))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Organiztion Space Membership ID |
Returns:
Promise for a Space Membership in an organization
- Type
- Promise.<SpaceMembership>
(static) getOrganizationSpaceMemberships(queryopt) → {Promise.<Array.<SpaceMembership>>}
- Source:
Gets a collection Space Memberships in organization
Example
const contentful = require('contentful-management')
client.getOrganization('organization_id')
.then((organization) => organization.getOrganizationSpaceMemberships()) // you can add queries like 'limit': 100
.then((response) => console.log(response.items))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
object |
<optional> |
Object with search parameters. Check the JS SDK tutorial and the REST API reference for more details. |
Returns:
Promise for a Space Membership collection across all spaces in the organization
- Type
- Promise.<Array.<SpaceMembership>>
(static) getTeam(id) → {Promise.<Team>}
- Source:
Gets an Team
Example
const contentful = require('contentful-management')
client.getOrganizations()
.then((organization) => organization.getTeam('teamId'))
.then((team) => console.log(team))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Team ID |
Returns:
Promise for an Team
- Type
- Promise.<Team>
(static) getTeamMembership(teamId, id) → {Promise.<TeamMembership>}
- Source:
Gets an Team Membership from the team with given teamId
Example
const contentful = require('contentful-management')
client.getOrganization('organizationId')
.then((organization) => organization.getTeamMembership('teamId', 'teamMembership_id'))
.then((teamMembership) => console.log(teamMembership))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
teamId |
string | Team ID |
id |
string | Team Membership ID |
Returns:
Promise for an Team Membership
- Type
- Promise.<TeamMembership>
(static) getTeamMemberships(optsopt) → {Promise.<Array.<TeamMembership>>}
- Source:
Get all Team Memberships. If teamID is provided in the optional config object, it will return all Team Memberships in that team. By default, returns all team memberships for the organization.
Example
const contentful = require('contentful-management')
client.getOrganization('organizationId')
.then((organization) => organization.getTeamMemberships('teamId'))
.then((teamMemberships) => console.log(teamMemberships))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
<optional> |
Properties
|
Returns:
Promise for a Team Membership Collection
- Type
- Promise.<Array.<TeamMembership>>
(static) getTeams(id) → {Promise.<Array.<Team>>}
- Source:
Gets all Teams in an organization
Example
const contentful = require('contentful-management')
client.getOrganizations()
.then((organization) => organization.getTeams())
.then((teams) => console.log(teams))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Team ID |
Returns:
Promise for a Team Collection
- Type
- Promise.<Array.<Team>>
(static) getTeamSpaceMembership(teamSpaceMembershipId) → {Promise.<TeamMembership>}
- Source:
Get a Team Space Membership with given teamSpaceMembershipId
Example
const contentful = require('contentful-management')
client.getOrganization('organizationId')
.then((organization) => organization.getTeamSpaceMembership('teamSpaceMembershipId'))
.then((teamSpaceMembership) => console.log(teamSpaceMembership))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
teamSpaceMembershipId |
string |
Returns:
Promise for a Team Space Membership
- Type
- Promise.<TeamMembership>
(static) getTeamSpaceMemberships(optsopt) → {Promise.<Array.<TeamSpaceMembership>>}
- Source:
Get all Team Space Memberships. If teamID is provided in the optional config object, it will return all Team Space Memberships in that team. By default, returns all team space memberships across all teams in the organization.
Example
const contentful = require('contentful-management')
client.getOrganization('organizationId')
.then((organization) => organization.getTeamSpaceMemberships('teamId'))
.then((teamSpaceMemberships) => console.log(teamSpaceMemberships))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
<optional> |
Properties
|
Returns:
Promise for a Team Space Membership Collection
- Type
- Promise.<Array.<TeamSpaceMembership>>
(static) getUser(id) → {Promise.<User.User>}
- Source:
Gets a User
Example
const contentful = require('contentful-management')
client.getOrganization('<organization_id>')
.then((organization) => organization.getUser('id'))
.then((user) => console.log(user))
.catch(console.error)
Parameters:
Name | Type | Description |
---|---|---|
id |
string | User ID |
Returns:
Promise for a User
- Type
- Promise.<User.User>
(static) getUsers(queryopt) → {Promise.<User.UserCollection>}
- Source:
Gets a collection of Users in organization
Example
const contentful = require('contentful-management')
client.getOrganization('<organization_id>')
.then((organization) => organization.getUsers())
.then((user) => console.log(user))
.catch(console.error)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
object |
<optional> |
Object with search parameters. Check the JS SDK tutorial and the REST API reference for more details. |
Returns:
Promise a collection of Users in organization
- Type
- Promise.<User.UserCollection>