Filters

Many EnergyCAP objects have a generic “GET All” API, one that returns a list of all objects of that type. In REST terms, these are GET requests that have no specified object in the URI. Example: https://{host}/api/v3/account

These APIs support the ability to filter the request, giving a developer the ability to narrow down what is returned as results for that given API.

APIs that support Filtering are designated as so.

Syntax

The EnergyCAP API has a custom syntax for filtering the APIs. Generally speaking, the syntax is made up of one or more complete statements, separated by the word ‘and.’

Statement

A statement is made up 3 pieces of information: the field, the operator and the quoted value.

Examples

Query the Bill API to return all bills matching a given account identifier:

/api/v3/bill?filter=accountId equals '1234'

Query the Bill API to return all bills matching a given account identifier and belonging to a meter underneath the given place:

/api/v3/bill?filter=accountId equals '1234' and topmostPlaceCode equals 'PlaceCode'

Query the Bill API to return all bills matching one of the given account identifiers:

/api/v3/bill?filter=accountId one of '1234'|'1000'|'20000'

Query the Bill API to return all bills between two total costs:

/api/v3/bill?filter=totalCost between '100'|'200'