Reading Data Items

Reading Data Items

The Backend Services JavaScript SDK can retrieve a single item or multiple items with a single service call. Multiple items are returned as an array.

Reading a Single Item by ID

To read an item, pass its ID to the data.getById() method.

var el = new Everlive('your-app-id');
var data = el.data('type-name');
data.getById('item-id')
    .then(function(data){
        alert(JSON.stringify(data));
    },
    function(error){
        alert(JSON.stringify(error));
    });

Reading Multiple Items

You can make a simple data.get() call to get all items of a content type as the next example shows. To limit the results, include a filtering or fields expression as described in Filtering and Getting a Subset of Fields. You can also modify the request to get sorted or paged results.

Multiple items are returned as an array.

var el = new Everlive('your-app-id');
var data = el.data('type-name');
data.get()
    .then(function(data){
        alert(JSON.stringify(data));
    },
    function(error){
        alert(JSON.stringify(error));
    });

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.