Getting the Item Count

Getting the Item Count

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

Simple count

To get items count of a content type, you have to execute the following code snippet:

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

Count plus filtering

You can get filtered items count by executing the following code snippet:

var filter = {
    "Author" : "Sample Text"
};

//Ajax request using jQuery
$.ajax({
    url: 'https://api.everlive.com/v1/your-app-id/type-name/_count',
    type: "GET",
    headers: {"Authorization" : "Bearer your-access-token-here",
               "X-Everlive-Filter" : JSON.stringify(filter) },
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
});
Request:
    GET https://api.everlive.com/v1/your-app-id/type-name/_count
Headers:
    Authorization  Bearer your-access-token-here
    X-Everlive-Filter { "Author" : "Sample Text" }
Response:
    Status: 200 OK
    Content-Type: application/json
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.