Skip to main content

List entries by content type

Log in to add to favourites

Page last updated 13 November 2024

Call the entries.list() method in our delivery client to get a paged list of entries of a given content type

Call signatures

TypeScript
list(contentTypeId: string): Promise<PagedList<Entry>>

list(options: EntryListOptions): Promise<PagedList<Entry>>

Parameters

NameTypeDescription
contentTypeIdstringThe id of the content type
optionsEntryListOptionsAn 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

Get a list of entries of a given content type API ID
TypeScript
// Using TypeScript, or ES Module await syntax
const entryList = await client.entries.list('<content-type-id>');

for (const entry of entryList.items) {
  console.log(entry.entryTitle);
}
Get a list of entries of a given content type API ID
JavaScript
// Using Common JS promise callback syntax
client.entries.list('<content-type-id>')
  .then(function (entryList) {
    entryList.items.forEach(item => (
      console.log(item.entryTitle)
    ))
  });

Example - using entry list options

Get only the title and overview fields of the French entry variations resolving linked content to a depth of 2
TypeScript
// Using TypeScript, or ES Module await syntax
const entryList = await client.entries.list({
  id: '<content-type-id>',
  language: 'fr-FR',
  linkDepth: 2,
  fields: ['title', 'overview']
})

for (const entry of entryList.items) {
  console.log(entry.title);
  console.log(entry.overview);
}
Get only the title and overview fields of the French entry variations resolving linked content to a depth of 2
JavaScript
// Using Common JS promise callback syntax
client.entries
  .list({
    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);
    ))
  });

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request