Skip to main content
Browse Documentation

List entries by content type

Created by Richard Saunders, last modified by Simon Horan on 23 Jan 2020

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

<ul id="film_list">
</ul>
(function(Zengenti) {
    // Create a client
    var client = Zengenti.Contensis.Client.create();

    $(function() {
        // Get a list of movies
        client.entries.list('movie').then(function(listOfFilms) {    

            for (var i = 0, ilen = listOfFilms.items.length; i < ilen; i++) {
                // loop through the entries adding their title to the list
                var film = listOfFilms.items[i];
                $('#film_list').append($('<li />').text(film.title));
            }

        }, function(error) {
            console.error(error);
        });

    });
})(Zengenti);

Example - using entry list options

<ul id="film_list">
</ul>
(function(Zengenti) {
    // Create a client
    var client = Zengenti.Contensis.Client.create();

    $(function() {
        // specify the options
        var options = {
            contentTypeId: 'movie', // get a list of movies
            language: 'fr-FR',  // get french variations
            order: ['title'],   // order by title field
            fields: ['title'],  // only return title field
            linkDepth: 1
        };

        // Get the list using the options
        client.entries.list(options).then(function(listOfFilms) {    

            for (var i = 0, ilen = listOfFilms.items.length; i < ilen; i++) {
                // loop through the entries adding their title to the list
                var film = listOfFilms.items[i];
                $('#film_list').append($('<li />').text(film.title));
            }

        }, function(error) {
            console.error(error);
        });

    });
})(Zengenti);