Socrata was acquired by Tyler Technologies in 2018 and is now the Data and Insights division of Tyler. The platform is still powered by the same software formerly known as Socrata but you will see references to Data & Insights going forward.

The $where Parameter

The $where parameter allows you to filter your results using boolean operators. For example, to retrieve only quakes with a magnitude of greater than 3.0:

https://soda.demo.socrata.com/resource/4tka-6guv.json?$where=magnitude > 3.0

You can also combine multiple filters together using boolean operators to chain filters together. If we also only wanted quakes from the pr source:

https://soda.demo.socrata.com/resource/4tka-6guv.json?$where=magnitude > 3.0 AND source = 'pr'

Multiple boolean operators are available to combine filters:

Operator Description Example
AND The logical and of two expressions. a AND b will return true ONLY if a and b are both true.
OR The logical or of two expressions. a or b will return true if either a or b are true.
NOT The logical not of an expression. NOT a will return true, ONLY if a is false.
IS NULL Whether a value is null or not. a IS NULL will return true, ONLY if a is null.
IS NOT NULL Whether a values is not null. a IS NOT NULL will return true, ONLY if a is not null
( ... ) Parentheses are used for defining order of operations. b>3 AND (a=1 OR a=2)

Note that using simple filtering, equality clauses can be simplified. And since multiple parameters are implicitly ANDed together, the above query can be simplified to:

https://soda.demo.socrata.com/resource/4tka-6guv.json?$where=magnitude > 3.0&source=pr

Multiple equality clauses can be even simpler:

https://soda.demo.socrata.com/resource/4tka-6guv.json?region=Virgin Islands region&source=pr