Table of Contents

Filtering - Reckon One API v2

Introduction

All API v2 endpoints that return a list of results support filtering. The filtering is applied before sorting and paging. Any field can be used in a filter, however some field types only support certain operators, functions etc.

A filter takes the following form:

{expression} {operator} {value}

An expression can be a field or one of several functions (depending on the field’s type). You can have multiple filters, separating them with and and or.

It is added to an endpoint URL as a query string parameter:

/r1/v2/{cashbookId}/ledgeraccounts?filter={expression} {operator} {value}


Supported operators

Key

Description

not

Not (must prefix an operator)

eq

Equal

ne

Not equal

gt

Greater than

ge

Greater than or equal to

lt

Less than

le

Less than or equal to

anyOf

In a list (string or number)

contains

Field value contains the specified string

startswith

Field value starts with the specified string

endswith

Field value ends with the specified string


String field functions

Key

Description

length(x)

Gets the length of the string

tolower(x)

Converts the string to lower case

toupper(x)

Converts the string to upper case

trim(x)

Removes whitespace (spaces, new lines etc.) from the beginning and the end of the string

substring(x, a, b)

Gets part of a string from position a for a length of b characters


Date / time field functions

Key

Description

day(d)

Gets the day

month(d)

Gets the month (as a number)

year(d)

Gets the year

hour(d)

Gets the hour

minute(d)

Gets the minute

second(d)

Gets the second


Number functions

Key

Description

round(n, x)

Rounds the number to x decimal places

floor(n)

Rounds the number down to the nearest whole number

ceiling(n)

Rounds the number up to the nearest whole number


Examples

Example

Explanation

name eq 'Joe Bloggs'

The name must be equal to Joe Bloggs (case sensitive)

tolower(name) contains 'bloggs'

The name converted to lower case must contain the word bloggs

tolower(name) endswith 'bloggs' and age ge 18

The name converted to lower case must end with the word bloggs and the age must be greater than or equal to 18

month(dateofbirth) eq 12

The month of the dateofbirth must be equal to December

trim(notes) ne ''

The notes must not be an empty string or just contain whitespace

round(amount,2) ge 100.00 and round(amount,2) lt 200.00

The amount must be between 100.00 and 199.99 when rounded to 2 decimal places

lastname anyOf ('Bloggs','Doe')

The lastname must be either Bloggs or Doe

quantity in (1,2,3)

The quantity must be 1, 2 or 3

round(amount,0) ge 1000 and quantity eq 1

The amount must be greater than or equal to 1000 and the quantity must be 1

How did we do?

Release Notes - Reckon One API v2

Paging - Reckon One API v2

Related Articles

Powered by HelpDocs (opens in a new tab)

Powered by HelpDocs (opens in a new tab)