# GraphQL & Rest API Filtering

> Source: https://agilitycms.com/docs/developers/graphql-operators

We support a number of operators to filter your content using GraphQL or the Rest API. This documentation goes over the raw usage of these operators when using these APIs. We also provide helper libraries in Javascript and C# which make building these filters a breeze.


## Usage

To query for a  property, you would use the `.` operator, like `fields.name`. To create a basic expression you would use square brackets to denote the operator from the operands for example, `fields.name[eq]\"Kevin\" `


> You will need to escape the quotation marks when using a string as an operand!

To query numeric values, do not wrap your operand in quotation marks. For example, here is a numeric query `fields.age[eq]28`

And of course you can chain your operators using the logical expressions `AND` and `OR` for example, `fields.age[eq]28 AND fields.name[eq]\"Kevin\"`


You can also use brackets to group your expressions together, the following will get people with the name Kevin and age 28, as well as people with the name Sarah and age 26 `(fields.name[eq]\"Kevin\" AND fields.age[eq]28) OR (fields.name[eq]\"Sarah\" AND fields.age[eq]26))`

## Basic Operators

`EQ` is the equality operator


`NE` is the "not equal" operator


`LT` & `GT` are the "less than" and "greater than" operators. They are meant for querying numeric fields


`LTE` & `GTE` similar to LT and GT, these are the "less than or equal to" and "greater than or equal to" operators, also meant for querying numeric fields.


## Advanced Operators

`IN` is for querying a field with a **singleton** as a value. The API will `stringify` the left hand operand to compare against the right hand operand, which is a comma separated field. For example, `fields.age[in]\"28,24,60,54\"`

`CONTAINS` is for querying a field with a **comma separated list** as a value. This is useful for **querying against linked content**. In the API it is usually denoted as `yourField_ValueField`. However this will work for any field that has a CSV as a value.

For example, this query will get people that have friends with the content ID of 32,45,65,33 `fields.friends_valueField[contains]\"32,45,65,33\"`

`LIKE` is for querying a string field, for example, `fields.description[LIKE]\"Hello\" `will retrieve all content with descriptions that have the word "hello" in int.

### Searching for Empty / null Values

If you want to search for an empty or null values, you can use this syntax:

`fields.fieldValue[eq]\"\"`

On the flip side, if you want to find NOT empty or NOT null values, use this syntax:

`fields.fieldValue[ne]\"\"`
