$union

The $union query parameter allows to execute more than one GET command and returns only one result. In the $union=( get command ) you can define a second GET command. Field order, field type and field count must be exactly the same as in the first GET command.

Only the $select and $filter commands are allowed in $union ( ... ).

youtube OData $union command

This is not an ODATA standard.

 

If the field names are not the same, you can rename the field names with the as command.

Example
get Item?$select=ItemName as Description

 

$orderby, $top, $skip and $format must be outside the $union brackets

$inlinecount=allpages is supported, but produces several SQL statements in the background. Use only if it is required.

 

Example: Get the Routing positions and parallel Resources in one request for work order 1382 Position 5.

 

 

PostMan

 

GET WorkorderRouting?$select=concat(DocEntry,"/",LineNumber,"/",Position,Workorder/DocNum) as info
   &$filter=DocEntry eq 1382 and LineNumber eq 5
   &$union=(
   WorkorderRoutingParallel?
      $select=concat(DocEntry,"/",LineNumber,"/",WorkorderRouting/Position, LineNumber3,Workorder/DocNum) as info
      %26$filter=DocEntry eq 1382 and LineNumber eq 5
        )

 

See youtube ODATA $union command