> For the complete documentation index, see [llms.txt](https://docs.northcommerce.com/north-commerce/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.northcommerce.com/north-commerce/for-developers/rest-api/filtering.md).

# Filtering

<table><thead><tr><th width="197.33333333333331">Relationship Type</th><th>Sample Attribute</th><th>Sample Value</th></tr></thead><tbody><tr><td>Simple Attribute</td><td>orders.total</td><td>Total value of the order</td></tr><tr><td>One-To-One</td><td>orders.shipping_address</td><td>A single address entity or null if one isn't set.</td></tr><tr><td>One-To-Many</td><td>order.line_items</td><td>An array of line_item entities. If there are no line_items associated with this order, the array is empty.</td></tr></tbody></table>

## Simple Filtering

The Rest API currently only supports simple filtering, while our "Server Side API" or "Entity Access" which can be accessed on the server side supports both simple and advanced filtering.&#x20;

Simple filtering allows the API caller to filter results by attributes that can be combined with the `and` logical operator. That format looks like:

```markup
<attributes>:<operator>:<value>,..
```

**Example**: Let's say you have a product that has some product variants. On the product variants table there is a column called `visible` and we want to filter all of theproduct variants that are visible that have a price over $80

{% code fullWidth="true" %}

```sh
$ curl -s -G '<base-url>/wp-json/nc-data/v1/product-variants' -d filter='product_variants.visible:eq:1,price:gt:80'   | jq .data
```

{% endcode %}

In order to get all the product variants we filter product\_variants.visible attribute eq (equal) to 1 since that column is a boolean `and` which is specified by the comma price is greather than 80.

## Supported Operators

The follow operators for filtering are supported.&#x20;

* `eq` - equals
* `equal` - equals
* `lt` - less than
* `gt` - greater than
* `like` - SQL LIKE operator *using `%` as the wildcard*
* `neq` - Not equal to

If you aren't familar with the SQL LIKE operator then using that filter will give you all the data that contains the filtered value. For example:

```markup
/wp-json/nc-data/v1/products?filter=name:like:%bracelet%
```

and in the above example I would return all the products that name contain the word `bracelet`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.northcommerce.com/north-commerce/for-developers/rest-api/filtering.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
