Filtering

The ServiceM8 API supports filtering of results by providing $filter option as part of a GET query request: $filter=FIELD OPERATOR 'VALUE'

Key

Description

FIELD

A valid field name for the current endpoint/record

OPERATOR

The type of comparison/operator

VALUE

The value to search for / compare against

πŸ“˜

URL want to get this right

Ensure that your filter statement is URL-encoded (see examples below), otherwise the API will return all records with no filtering applied.

Operators

Operator

Description

eq

Equal

ne

Not Equal

gt

Greater Than

lt

Less Than

Examples

All Job records for a single client

$filter is company_uuid eq β€˜10420f98-7626-4405-bf43-043f1036623b’

curl -u email:password "https://api.servicem8.com/api_1.0/job.json?%24filter=company_uuid%20eq%20'10420f98-7626-4405-bf43-043f1036623b'"

All Jobs where invoiced amount was greater than $1000.00

$filter is total_invoice_amount gt β€˜1000.00’

curl -u email:password "https://api.servicem8.com/api_1.0/job.json?%24filter=total_invoice_amount%20gt%20'1000.00'"

πŸ“˜

One at a time, please

The ServiceM8 API supports only a single filter parameter per request. If you need more specific filtering, choose your filter such that you get the smallest number of records that is practical, then inspect the results in your application and discard any that do not match your requirements.