- 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 | |
getOrganizationMembership |
function | |
getOrganizationMemberships |
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) 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) getOrganizationMembership(id) → {Promise.<OrganizationMembership.OrganizationMembership>}
- Source:
Gets an Organization Membership
Example
const contentful = require('contentful-management')
client.getOrganizations()
.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.getOrganizations()
.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.getOrganizations()
.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.getOrganizations()
.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>>