Webinar (on-demand): OutSystems and Analytics Integration: A New Strategy to Reduce Costs

Discover everything you need to know about Hubway Connect

Try the product online without any installation or purchase commitment
Hubway Connect

Innovative ways to leverage your data for business outcomes

Find out how Hubway Connect can help you get more value from your OutSystems platform
Hubway Connect

Learn and expand your Hubway Connect knowledge

Deep dive in articles, videos and technical information to maximise its use
Hubway Connect

Start free and expand without surprises

Choose the Hubway Connect offer that best meets your needs and suits your budget
Hubway Connect

We are here to help. Let’s talk.

Connect with us via your preferred channel and we will be happy to answer your questions
Hubway Connect
  1. Home
  2. Knowledge Base
  3. FAQs
  4. Consuming the service
  5. Filters with OData and URL conventions

Filters with OData and URL conventions

If you need to add filtering logic to your API, here’s a quick guide with the most common operators:

Example:

/Order?$filter=CreatedOn gt 2006-12-30T23:59:59.99Z

 

The Equals operator (or ‘eq’) evaluates to true if the left operand is equal to the right operand, otherwise if evaluates to false.

Ex.: /Order?$filter=OrderStatusId eq 5

The URL above will return all the Orders with OrderStatusId = 5 (Approved)

 

Other operators include:

  • Not Equals (or ‘ne’)
  • Greater Than (or ‘gt’)
  • Greater Than or Equal (or ‘ge’)
  • Less Than (or ‘lt’)
  • Less Than (or ‘le’)
  • Logical And (or ‘and’)
  • Logical Or (or ‘or’)
  • Logical Negation Operator (or ‘not’)

The following examples illustrate the use and semantics of each of the logical operators:

 

Product?$filter=Name eq ‘Milk’ (Requests all products with a Name equal to ‘Milk’)

Product?$filter=Name ne ‘Milk’ (Requests all products with a Name not equal to ‘Milk’)

Product?$filter=Name gt ‘Milk’ (Requests all products with a Name greater than ‘Milk’)

Product?$filter=Name ge ‘Milk’ (Requests all products with a Name greater than or equal to ‘Milk’)

Product?$filter=Name lt ‘Milk’ (Requests all products with a Name less than ‘Milk’)

Product?$filter=Name le ‘Milk’ (Requests all products with a Name less than or equal to ‘Milk’)

Product?$filter=Name eq ‘Milk’ and Price lt ‘2.55M’ (Requests all products with the Name ‘Milk’ that also have a Price less than 2.55)

Product?$filter=Name eq ‘Milk’ or Price lt ‘2.55M’ (Requests all products that either have the Name ‘Milk’ or have a Price less than 2.55)

Product?$filter=not endswith(Name, ‘ilk’) (Requests all products that do not have a Name that ends with ‘ilk’)

 

For more reference and examples, refer to the official OData documentation page on URL conventions:

https://www.odata.org/documentation/odata-version-3-0/url-conventions/

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support