Skip to content

Object/File Counts

Backendless version 5.x introduces new API to calculate total number of objects and files in a remote collection. In the previous version of Backendless, that number was included as a property of the returned collection. See the examples below:

Version 3.x

Request to get objects and object count. The example retrieves objects for a query age > 21. Object count is returned as a part of the response.

curl -X GET -H 'application-id:application-id-from-console' -H 'secret-key:rest-secret-key-from-console' https://api.backendless.com/v1/data/Contact?where=age%20%3E%2021

Server response. Notice the totalObjects property in the response.

{  
  "offset": 0,  
  "data": [  
    {  
      "addresses": [],  
      "phone": "1-972-5551212",  
      "created": 1485820899000,  
      "name": "Joe",  
      "___class": "Contact",  
      "title": "Plumber",  
      "ownerId": null,  
      "updated": 1485985183000,  
      "objectId": "660B5250-BBCF-1A37-FF9E-7887C67ABD00",  
      "age": 27,  
      "__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[  
                  \"addresses\",\"phone\",\"created\",\"name\",\"___class\",  
                  \"title\",\"ownerId\",\"updated\",\"objectId\",\"age\"],  
                 \"relatedObjects\":{}}"  
    }  
  ],  
  "nextPage": null,  
  "totalObjects": 1  
}

Version 5.x

Request to get object count. The example retrieves objects for a query age > 21:

curl https://api.backendless.com/application-id/rest-api-key/data/Contact?where=age%20%3E%2021

Server response - the number of objects matching the query:

3

Additional resources: