Filtering
Dataloy REST API uses a generic search/filtering functionality. In general, all resources supports filtering on all properties of that resource and linked resources (for exceptions, see Limitations).
Syntax
The filter query parameter has the following format:
<Base URL>/<Resource>?filter=<json property>(OPERATOR)<value>
Example that will return currency information for USD:
localhost/ws/rest/Currency?filter=currencyCode(EQ)USD
Syntax Breakdown <Base URL>
For more information see Getting Started with Dataloy REST API
<Resource>
Can be any of the Resources available in the Dataloy API.
<json property>
Can be any json property of the resource (for exceptions, see Limitations).
<OPERATOR>
The operator is always:
surrounded by parenthesis
is always upper case
List of Operators
(EQ)
Equals Exact Value, case sensitive
Get a Document with document number 2707374: Document?filter=documentNo(EQ)2707374
(NE)
Not Equal
Get all Documents not in company 1000: Document?filter=company.companyCode(NE)1000
(GT)
Greater Than
ONLY numeric and date values
Get all Voyages modified since 2014-01-01 00:00:00, not including 2014-01-01 00:00:00: Voyage?filter=modifiedDate(GT)2014-01-01T00:00:00
(GTE)
Greater Than or Equal
ONLY numeric and date values
Get all Voyages modified since 2014-01-01 00:00:00, including 2014-01-01 00:00:00: Voyage?filter=modifiedDate(GTE)2014-01-01T00:00:00
(LT)
Lesser Than
ONLY numeric and date values
Get all Documents that has document amount less than 100000: Document?filter=documentAmount(LT)100000
(LTE)
Lesser Than or Equal
ONLY numeric and date values
Get all Documents that has document amount less than 100000, including 100000: Document?filter=documentAmount(LT)100000
(IN)
Equals One of the Elements in a Given List
Get all Documents that are ready for posting and has status type INI, INO, CRI or CRO: Document?filter=invoicingStatus.statusTypeCode(EQ)RFP&filter=invoicingStatus.statusTypeCode(IN)(INI,INO,CRI,CRO)
(NULL)
Filter for NULL values
2.10
Get all Documents without business partner: Document?filter=businessPartner(NULL)
(NOTNULL)
Filter for NOT NULL values
2.10
Get all Voyages with vessel: Voyage?filter=vessel(NOTNULL)
(LK)
Like operator
3.3
Get all BunkerOrder with externalReferenceNo containing the string "test" case sensitive: BunkerOrder?filter=externalReferenceNo(LK)test
(LKIC)
Like ignore case operator
3.3
Get all BunkerOrder with externalReferenceNo containing the string "test" case insensitive: BunkerOrder?filter=externalReferenceNo(LKIC)test
(NLK)
Not like
8.5
Get all BunkerOrder with externalReferenceNo not containing the string "test" case sensitive: BunkerOrder?filter=externalReferenceNo(NLK)test
(NLKIC)
Not like ignore case
8.5
Get all BunkerOrder with externalReferenceNo not containing the string "test" case insensitive: BunkerOrder?filter=externalReferenceNo(NLK)test
(NOTIN)
Is not one of the elements in a given list
8.13
Get all Documents that are ready for posting and has status type other than CRI or CRO: Document?filter=invoicingStatus.statusTypeCode(EQ)RFP&filter=invoicingStatus.statusTypeCode(NOTIN)(CRI,CRO)
<value>
Numeric Values are straight forward. Can be integers or decimal numbers using a dot as decimal point.
Dates must be specified in the format: yyyy-MM-ddTHH:mm:ss
Strings can be surrounded by double quotes, but it is generally not necessary. Even if the string has spaces.
Boolean must be specified with 0 for false and 1 for true.
Combining Filters
The filter URL parameter can be added multiple times to filter on multiple properties in one request. To do so, add a new filter parameter to the end of the URL
Syntax for Combining Filters
<Base URL>/<Resource>?filter=<json property>(OPERATOR)<value>&filter=<json property 2>(OPERATOR)<value>
Example:
<Base URL>/Document?filter=invoicingStatus.statusTypeCode(EQ)RFP&filter=invoicingStatus.statusTypeCode(IN)(INI,INO,CRI,CRO) Invoices ready to be transferred to accounting will be returned.
Properties for Sub Objects
Filters can be used for sub objects by using a "dot path". Example of a sub object is commodity on Cargo:
To search for cargoes with commodity steel:
<Base URL>/Cargo?filter=commodity.commodityCode(EQ)10000
Limitations
The following properties are currently not possible for filtering:
self
remarks
A few other properties are unsupported, these are documented for each resource.
Default filters on list endpoints
Some resources apply a default filter when you list them. It hides rows most callers don't want, and you can turn it off on any request.
Where it applies: list queries only: GET /{Resource} with filter or expression, GET /{Resource}/expand and the XML list. It never applies to GET /{Resource}/{key} or to objects you reach through another resource's relationships (for example a voyage's cargos).
Turning it off: filter on the default's property yourself, with any operator. A URL filter on the property or on a path below it counts (masterCargo(NOTNULL), masterCargo.key(EQ)(42)), and so does an expression that mentions the property. There is no separate "disable defaults" parameter.
Filtering on key turns off every default. If you ask for specific keys, you get all of them.
Response header when a default was applied: the response has an appliedDefaultQualifiers header with the affected properties, comma separated (e.g. appliedDefaultQualifiers: masterCargo). totalObjectsNumber and paging are counted with the default applied. The API metadata lists each resource's defaults under defaultQualifiers (property, expression, description).
Active default filters
Cargo
masterCargo
Cargos that are copies of a master cargo (masterCargo is set)
Voyage
cargos.masterCargo
Voyages carrying at least one copy cargo, even if they also carry master cargos
Examples
Cargo
Get Cargo with freight more than 1000000 and freightCurrency USD or EUR:
/Cargo?filter=freight(GT)1000000&filter=freightCurrency.currencyCode(IN)USD,EUR
Document
Get Documents with documentType "INV" and invoicingStatus "PEN"
/Document?filter=documentType.documentType(EQ)INV&filter=invoicingStatus.statusTypeCode(EQ)PEN
Voyage
Get Voyages for the vessel with vessel code ABRA
/Voyage?filter=voyageHeader.vesselCode.vesselCode(EQ)ABRA
Get Voyage with reference number VES100
/Voyage?filter=voyageHeader.referenceNo(EQ)VES100
Get Voyage with start date > 01.01.2016 and operator is user with userCode "BAK"
/Voyage?filter=voyageHeader.voyageStartDate(GT)2016-01-01T00:00:00&voyageHeader.operator.userCode(EQ)BAK
Get Voyages that are operational for vessel ABRA
/Voyage?filter=voyageHeader.voyageStatus.statusTypeCode(EQ)OPR&filter=voyageHeader.vesselCode.vesselCode(EQ)ABRA
Get all Voyages that has Oslo as Load Port in 2015
/Voyage?filter=portCalls.reasonForCall.reasonForCall(EQ)L&filter=portCalls.port.portName(EQ)OSLO&filter=voyageHeader.voyageStartYear(EQ)2015
Was this helpful?