Data Aggregation APIs

Today we are introducing the cloudbase.io Data Aggregation APIs. A new way to access and manipulate your data while leaving the cloudbase.io servers to do the heavy lifting and deliver to your mobile application only what you need.

You can think of these APIs as a “GROUP BY” statement in good old SQL.

On cloudbase.io data aggregation is done through what we call Aggregation Commands. Our APIs implement a number of aggregation commands for you to call and mix. In one API call to the cloudbase.io Data Aggregation APIs you can supply any number of aggregation commands in an ordered list. These will be executed one at a time and the output from each command will be passed on to the next to be further elaborated. This list of aggregation commands is effectively like a set of shell commands separated by “|” (pipe) in *nix operative systems.

We are hard at work to constantly add new commands and operators to make our APIs as clever and simple as possible. Get in touch with us if your application has a requirement which you think could be fulfilled by our aggregation APIs and would like to suggest a new command.

A full documentation for the data aggregation commands is available in the REST APIs documentation section and in each of the helper class documentations. The cloudbase.io Data Aggregation Commands are already implemented in all of the helper classes, just head over to the cloudbase.io GitHub account to download the latest version of the helper class you need.

To explain how this works we are going to use a static collection example containing some stock market data. You can paste the CSV below in a file and use it to create a static collection in your Cloud Database to test with.

Now assume we want to get the average price for all stocks in our collection.

The existing search condition objects (in iOS CBDataSearchConditionGroup) can also be concatenated with other aggregation commands to filter the results. For example, if we wanted to retrieve only the average stock price for Apple shares we would concatenate this search condition after the Project Command in the Array.