Skip to main content
Browse Documentation

Get a list of all entries by content type

Created by Richard Saunders, last modified by noellambertwork on 21 Dec 2017

Requesting all entries for a content type can be achieved by using the list method on the client's entries property.

list(): Promise<PagedList<Entry>>

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

Parameters

Name Type Description
options EntryListOptions An object specifying the 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="entry_list">
</ul>
(function(Zengenti) {
    var client = Zengenti.Contensis.Client.create();
    $(function() {
        client.entries.list().then(function(listOfEntries) {    
            for (var i = 0, ilen = listOfEntries.items.length; i < ilen; i++) {
                var entry = listOfEntries.items[i];
                $('#entry_list').append($('<li />').text(film.entryTitle));
            }
        }, function(error) {
            console.error(error);
        });
    });
})(Zengenti);

Example - using entry list options

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

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

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

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

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

    });
})(Zengenti);