/
Filtering

Filtering

Short Description

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).

 

Chapter Contents: 

Long Description
 

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

OperatorDescription

API Version

Example

(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 operator3.3Get all BunkerOrder with externalReferenceNo containing exactly the string "test": BunkerOrder?filter=externalReferenceNo(LK)test
(LKIC)Like ignore case operator3.3Get all BunkerOrder with externalReferenceNo containing the string "test" regardless upper or lower case: BunkerOrder?filter=externalReferenceNo(LKIC)tEsT

 

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

Part of the Cargo resource as an example: 
 
{
	"cargoReference": 12345,
	"freight": 20000,
	"cargoQuantity":100000,
    "commodity": {
            "commodityName": "Steel",
            "commodityCode": "10000",
            "key": 1069734,
            "self": "http://localhost:8080/ws/rest/Commodity/1069734"
    }
}

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.


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


Top
Back

Related Content

 Expand to see related content

Unknown macro: {dynamiccontentbylabel}

Related content

Getting Started with Dataloy REST API
Getting Started with Dataloy REST API
More like this
/Vessel
Read with this
Changes in Version 1.0
Changes in Version 1.0
More like this
Dataloy REST API Integration
Dataloy REST API Integration
Read with this
Dataloy API 2.10 Release Notes
Dataloy API 2.10 Release Notes
More like this
Expressions Made Easy
Expressions Made Easy
Read with this