Getting the Return Items Count

Getting the Return Items Count

The count of items matching the filtering condition is always returned in the result but you can choose to return the count only without retrieving the actual items. To do that, append /_count to type-name in the URL. Write an X-Everlive-Filter header as usual.

The next example retrieves the count of all items located in a radius of five kilometers from a Geo Point.

//Ajax request using jQuery
var filter = {
    "Location": {
        "$within": {
            "$centerSphere": {
                "center": {
                    "longitude": 23.379068, "latitude": 42.650601
                },
                "radiusInKilometers": 5
            }
        }
    }
}

$.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
Header:
    Authorization  Bearer your-access-token-here
    X-Everlive-Filter {
        "Location": {
            "$within": {
                "$centerSphere": {
                    "center": {
                        "longitude": 23.379068, "latitude": 42.650601
                    },
                    "radiusInKilometers": 5
                }
            }
        }
    }

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.