Initial Implementation of the API. Also added the aggregate querys into the API.