Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Getting the Item Count

The get count operation returns the number of result items instead of the items themselves. This can save you bandwidth and processing on the client.

Note

If you want to count grouped data, use the count aggregation function; the _count endpoint does not support aggregated/grouped data.

The following example returns the count of all content stored in the Books content type.

Request:
    GET https://api.everlive.com/v1/your-app-id/Books/_count
Headers:
    Authorization  Bearer your-access-token

Response:
    Status: 200 OK
    Content-Type: application/json
//Ajax request using jQuery
$.ajax({
    url: 'https://api.everlive.com/v1/your-app-id/Books/_count',
    type: "GET",
    headers: {"Authorization" : "Bearer your-access-token"},
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
});

You can also count filtered results. For example, you can request the count of books written by a single author.

Request:
    GET https://api.everlive.com/v1/your-app-id/Books/_count
Headers:
    Authorization  Bearer your-access-token
    X-Everlive-Filter { "Author" : "John Doe" }

Response:
    Status: 200 OK
    Content-Type: application/json
var filter = {
    "Author" : "John Doe"
};

//Ajax request using jQuery
$.ajax({
    url: 'https://api.everlive.com/v1/your-app-id/Books/_count',
    type: "GET",
    headers: {"Authorization" : "Bearer your-access-token",
               "X-Everlive-Filter" : JSON.stringify(filter) },
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: 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.