Namespace: ContentfulClientAPI

ContentfulClientAPI

Contentful Management API Client. Contains methods which allow access to any operations that can be performed with a management token.

Type Definitions

ClientAPI #

Type:
Object
Properties:
Name Type Description
getSpace function
getSpaces function
createSpace function
Source:

ErrorResponse #

Errors received from server requests
Properties:
Name Type Description
name string Error name. Usually refers to the sys.id returned on the error server response. If that's not available or is unknown, it defaults to the HTTP error code and status text.
message string Stringified JSON object with request information, HTTP response details and error details payload (if available). The `requestId` property is internal to Contentful and it can be used when contacting support about unusual errors.
Source:

Methods

(static) createSpace(data, organizationIdopt) → {Promise.<Space.Space>} #

Creates a space
Parameters:
Name Type Attributes Description
data object Object representation of the Space to be created
organizationId string <optional>
Organization ID, if the associated token can manage more than one organization.
Returns:
Promise for the newly created Space
Type:
Promise.<Space.Space>
Source:
See:
Example
client.createSpace({name: 'Space Name'})
.then(space => console.log(space))

(static) getSpace(id) → {Promise.<Space.Space>} #

Gets a space
Parameters:
Name Type Description
id string Space ID
Returns:
Promise for a Space
Type:
Promise.<Space.Space>
Source:
Example
client.getSpace('spaceid')
.then(space => console.log(space))

(static) getSpaces() → {Promise.<Space.SpaceCollection>} #

Gets all spaces
Returns:
Promise for a collection of Spaces
Type:
Promise.<Space.SpaceCollection>
Source:
Example
client.getSpaces()
.then(spaces => console.log(spaces.items))