Difference between Deep Insert and $batch OData

odata

Solution

Deep Insert is part of the OData specification, see http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793718.

Deep Insert allows creating a tree of related entities in one request. It is insert only.

$batch allows grouping arbitrary requests into one request, and arbitrary modifying operations into LUWs (called change sets).

For insert-only cases Deep Insert is easier: you just POST the same format that you would GET with $expand.

Problem

Can any one tell me the difference between usage of Deep Insert and $batch - ChangeSet in the context of OData ? I have a scenario that requires creation of a Sales Order Header and Sales Order Items together. - I can either user Deep Insert (BTW is this standard OData spec ?) or - I can use a $batch (this is standard OData spec) call with these two entities specified as a part of the same ChangeSet, which would ensure that they get saved together as a part of a single LUW. What are the pros / cons of using either of these approaches ? Any experiences ? Cheers

Original source

Related problems