/
Sub queries

Sub queries

API 5.21 supports sub-queries during any API query.

The syntax is:

  • filter=attributeName(OPERATOR){ResourceName.attributeName[filter_1],[filter_2],[filter_n]}

en-capsuling sub-queries between {} and the filters inside the sub-queries as list inside [ ]

Here an example to get the ongoing cargoes of a list of business partners:

http://dataloy.com/ws/rest/Cargo?filter=charterer.businessPartnerCode(IN)(133105,105882,123125,136200)&filter=key(IN)({Cargo.key[cargoPorts.portCall.eventLogs.event.eventCode(EQ)ARR][cargoPorts.portCall.eventLogs.eventLogDate(GT)2020-06-18T17:02:21][cargoPorts.cargoPortSequence(EQ)1],[cargoPorts.reasonForCall.reasonForCall(EQ)D]})&filter=key(IN)({Cargo.key[cargoPorts.portCall.eventLogs.event.eventCode(EQ)DEP][cargoPorts.portCall.eventLogs.eventLogDate(LT)2020-06-18T17:02:21][cargoPorts.cargoPortSequence(EQ)1],[cargoPorts.reasonForCall.reasonForCall(EQ)L]})

 

http://dataloy.com/ws/rest/Cargo?filter=charterer.businessPartnerCode(IN)(133105,105882,123125,136200)&filter=key(IN)(%7BCargo.key[cargoPorts.portCall.eventLogs.event.eventCode(EQ)ARR][cargoPorts.portCall.eventLogs.eventLogDate(GT)2020-06-18T17:02:21][cargoPorts.cargoPortSequence(EQ)1],[cargoPorts.reasonForCall.reasonForCall(EQ)D]%7D)&filter=key(IN)(%7BCargo.key[cargoPorts.portCall.eventLogs.event.eventCode(EQ)DEP][cargoPorts.portCall.eventLogs.eventLogDate(LT)2020-06-18T17:02:21][cargoPorts.cargoPortSequence(EQ)1],[cargoPorts.reasonForCall.reasonForCall(EQ)L]%7D)

The character { must be encoded with %7B and } with %7D

 

 

Related content

Expressions
Expressions
More like this
Filtering
Filtering
More like this
Service Order Integration
Service Order Integration
Read with this
OR and AND operators in API queries
OR and AND operators in API queries
More like this
Authentication/Authorization
Authentication/Authorization
Read with this
Left join in API queries
Left join in API queries
More like this