List entries by content type
Log in to add to favouritesDeprecation warning
We recommend using search rather than the list method. Search is more performant and offers more flexibility than the list method.
Requesting all entries for a content type can be achieved by using the list method on the client's entries property.
list(contentTypeId: string): Promise<PagedList<Entry>>
list(options: EntryListOptions): Promise<PagedList<Entry>>
Parameters
Name | Type | Description |
---|---|---|
contentTypeId | string | The id of the content type |
options | EntryListOptions | An object specifying the content type id, language, page options, ordering, fields to return and linkDepth. |
Returns
A Promise that will resolve with a Paged List of Entry
Example - using content type id
ContensisClient.entries.list('<content-type-id>').then(function (entryList) {
entryList.items.forEach(item => (
console.log(item.entryTitle)
))
});
Example - using entry list options
ContensisClient.list
.get({
id: '<content-type-id>',
language: 'fr-FR',
linkDepth: 2,
fields: ['title', 'overview']
})
.then(function (entryList) {
entryList.items.forEach(item => (
console.log(item.title);
console.log(item.overview);
))
});