North Commerce
Back to North Commerce
  • 🚀Getting Started
    • Welcome to North Commerce
    • Installation
  • ⛰️Core Concepts
    • Orders
    • Products
      • Create a product
      • One Time Products
      • Subscription Products
      • Payment Plan Products
  • 💳Payment Gateways & Merchants
    • Stripe
    • PayPal
  • 📄Single Page Checkout Forms & Funnels
    • Single Page Checkout
  • 🎨Styling
    • Global CSS Variables
  • Builders
    • Beaver Builder
      • Building With Beaver Builder
    • Bricks
      • Query Loop
      • Attributes
        • Cart Item Attributes
    • Oxygen
  • Shortcodes
    • Product Collections
    • Product Collection Slider
    • Product Page
    • Cart Page
    • Checkout Page
    • Cart Drawer
    • Cart Icon
    • Customer Registration
    • Customer Account
  • Settings
    • General
  • For Developers
    • Flows
      • Add To Cart
      • Flow Events
      • Custom Functions In Flows
    • PHP "API"
      • Basic Entity Access Usage
    • Hooks & Actions
      • View Admin Hook Names
    • REST API
      • Getting Started
      • Adding Test Data
      • Filtering
  • Integrations
    • Create an integration
Powered by GitBook
On this page
  • Simple Filtering
  • Supported Operators

Was this helpful?

  1. For Developers
  2. REST API

Filtering

When accessing data via the API, there are three types of relationships that are exposed. They are described below.

Relationship Type
Sample Attribute
Sample Value

Simple Attribute

orders.total

Total value of the order

One-To-One

orders.shipping_address

A single address entity or null if one isn't set.

One-To-Many

order.line_items

An array of line_item entities. If there are no line_items associated with this order, the array is empty.

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.

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

<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

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

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.

  • 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:

/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

PreviousAdding Test DataNextCreate an integration

Last updated 10 months ago

Was this helpful?