Skip to content

Latest commit

 

History

History
79 lines (63 loc) · 2.27 KB

list-entries.md

File metadata and controls

79 lines (63 loc) · 2.27 KB
description
Requesting all entries for a content type can be achieved by using the list method on the client's entries property.

Get a list of all entries by content type

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);