Add filters

You filter the results returned by the Connectivity Management API using the API query language.

Info: To check whether a specific endpoint accepts filters, see the API Reference documentation.

Supported filter operators

The API query language supports comparison, logical, and grouping filter operators. For example, rather than requesting a list of every user in your company, you can use a comparison operator to request every user with a particular name.

The following tables show you the different types of operators you can use to filter your results.

Comparison operators

Operator

Description Example
eq

Returns results that are equal to the specified value.

name eq "Alan"
ne

Returns results that are not equal to the specified value.

name ne "Nicole"
like

Returns results that include the specified value as a sub-string.

name like "Al"
gt

Returns results that are greater than the specified value.

cost gt 100
ge

Returns results that are greater than or equal to the specified value.

cost ge 100
lt

Returns results that are less than the specified value.

cost lt 150
le

Returns results that are less than or equal to the specified value.

cost le 150

Logical operators

Operator Description Example
and

Returns results that match both the specified conditions.

name eq "Alan" and age gt 10
or

Returns results that match either of the specified conditions.

name eq "Alan" or age eq 10

not

Negates whatever comparison follows directly after it.

not cost le 10

Grouping operators

Operator Description Example
()

Gives precedence to the statement inside the brackets.

(city eq "Glasgow" or city eq "Edinburgh") and color eq "red"

Filter query formatting

Depending on the type of data you are filtering by, you may be required to wrap your query in quotation marks. The following table outlines when you are required to use quotation marks, and provides an example of how to format your request.

Data type

Quotation marks required?

Example
String

Yes

tariffName eq "My Operator Global"
Dates and times Yes expiryDateTime eq "2018-02-11T10:33:30.000Z"
Integers No lineRental eq 1000
Boolean No isActive eq true

Example API calls

The following illustrations show you how to add filter operators to API calls.

This example returns all subscribers with a line rental fee of 1,000.

GET "https://connectivity-eu-api.pelion.com/subscribers?filter=(lineRental eq 1000)" 

This example returns all subscribers with a line rental fee greater than 1,000.

GET "https://connectivity-eu-api.pelion.com/subscribers?filter=(lineRental gt 1000)"

This example returns all subscribers on the My Operator Global rate plan, or the My Operator Europe rate plan.

GET "https://connectivity-eu-api.pelion.com/subscribers?filter=(tariffName eq "My Operator Global" or tariffName eq "My Operator Europe")"