Contentful CDA API
Type Definitions
ClientAPI
- Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
getSpace |
function | |
getContentType |
function | |
getContentTypes |
function | |
getEntry |
function | |
getEntries |
function | |
getAsset |
function | |
getAssets |
function | |
sync |
function |
- Source:
Methods
(static) getAsset(id) → {Promise.<Entities.Asset>}
Gets an Asset
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
Promise for an Asset
- Type:
- Promise.<Entities.Asset>
- Source:
Example
client.getAsset('assetId')
.then(asset => console.log(asset))
(static) getAssets(queryopt) → {Promise.<Entities.AssetCollection>}
Gets a collection of Assets
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
Object |
<optional> |
Object with search parameters. Check Search Parameters for more details. |
Returns:
Promise for a collection of Assets
- Type:
- Promise.<Entities.AssetCollection>
- Source:
Example
client.getAssets()
.then(assets => console.log(assets.items))
(static) getContentType(id) → {Promise.<Entities.ContentType>}
Gets a Content Type
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
Promise for a Content Type
- Type:
- Promise.<Entities.ContentType>
- Source:
Example
client.getContentType('contentTypeId')
.then(contentType => console.log(contentType))
(static) getContentTypes(queryopt) → {Promise.<Entities.ContentTypeCollection>}
Gets a collection of Content Types
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
Entities.Query |
<optional> |
Query object |
Returns:
Promise for a collection of Content Types
- Type:
- Promise.<Entities.ContentTypeCollection>
- Source:
Example
client.getContentTypes()
.then(contentTypes => console.log(contentTypes.items))
(static) getEntries(queryopt) → {Promise.<Entities.EntryCollection>}
Gets a collection of Entries
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
query |
Object |
<optional> |
Object with search parameters. Check Search Parameters for more details.
Properties
|
Returns:
Promise for a collection of Entries
- Type:
- Promise.<Entities.EntryCollection>
- Source:
Example
client.getEntries({content_type: 'contentTypeId'})
.then(entries => console.log(entries.items))
(static) getEntry(id) → {Promise.<Entities.Entry>}
Gets an Entry
Parameters:
Name | Type | Description |
---|---|---|
id |
string |
Returns:
Promise for an Entry
- Type:
- Promise.<Entities.Entry>
- Source:
Example
client.getEntry('entryId')
.then(entry => console.log(entry))
(static) getSpace() → {Promise.<Entities.Space>}
Gets the Space which the client is currently configured to use
Returns:
Promise for a Space
- Type:
- Promise.<Entities.Space>
- Source:
Example
client.getSpace()
.then(space => console.log(space))
(static) sync(query) → {Promise.<Sync.SyncCollection>}
Synchronizes either all the content or only new content since last sync
See Synchronization for more information.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
query |
Object | Query object for the sync call. One of initial or nextSyncToken always needs to be specified, but not both.
Properties
|
Returns:
Promise for the collection resulting of a sync operation
- Type:
- Promise.<Sync.SyncCollection>
- Source:
Example
client.sync()
.then(response => console.log(response.entries, response.assets, response.nextSyncToken))