Skip to Content
Author's profile photo Ralf Handl

OData V4.01 approved as a Committee Specification

Four years after OData V4 became an OASIS standard, and two years after it became the ISO/IEC 20802 standard, the first “feature pack” for OData V4 has been officially published.

The complete set of changes is described in What’s New in OData Version 4.01.

For me the most important new features are:

  • JSON Metadata
  • JSON Batch Format
  • Deep Update and Deep Upsert
  • Mass Operations
  • Improved Query Capabilities

JSON Metadata

Finally there’s a JSON format for $metadata, so clients don’t need an XML parser any more for interacting with an OData service. This format is very streamlined, so

<EntityType Name="Country">
  <PropertyRef Name="Code"/>
  <Property Name="Code" Type="Edm.String" MaxLength="2" Nullable="false"/>
  <Property Name="Name" Type="Edm.String"/>

simply becomes

"Country": {
  "$Kind": "EntityType",
  "$Key": [
  "Code": {
    "$MaxLength": 2
  "Name": {
    "$Nullable": true

And of course on the wire all whitespace is removed:


JSON Batch Format

The multi-part format for $batch was tricky to create and hard to read; now there is a JSON format for batch requests and responses which is simply an array of request or response objects:

  "requests": [
      "id": "0",
      "method": "get",
      "url": "/service/Customers('ALFKI')"
      "id": "1",
      "atomicityGroup": "group1",
      "dependsOn": ["0" ],
      "method": "patch",
      "url": "/service/Customers('ALFKI')",
      "headers": {
        "Prefer": "return=minimal"
      "body": <JSON representation of changes to Customer ALFKI>
      "id": "2",
      "atomicityGroup": "group1",
      "method": "post",
      "url": "/service/Customers",
      "body": <JSON representation of a new Customer entity>
      "id": "3",
      "dependsOn": [ "group1" ],
      "method": "get",
      "url": "/service/Products"

While we were at it, we optimized it for parallelized execution and better dependency control between individual requests within the batch via atomicityGroup and dependsOn.

Deep Update and Deep Upsert

You already could create a deeply nested tree of entities in one go with Deep Insert, now you can PATCH an entity graph by sending a nested tree of stuff to add or change, and if the PATCH target doesn’t exist yet, it is simply created, thus Deep Upsert.

Mass Operations

Even though the new JSON Batch Format is easier to create, some things are more naturally expressed as a mass operation.

Simply PATCH an entity set with an array of many new/changed entities, and of course this can be an array of Deep Upsert structures.

UPDATE WHERE and DELETE WHERE now have their OData counterparts:

PATCH /service/Products/$filter=@bar/$each?@bar=Color eq 'beige-brown'
Content-Type: application/json
  "Color": "taupe"


DELETE /service/Products/$filter=@foo/$each?@foo=Age gt 3

Improved Query Capabilities

Ever wanted to compute a virtual property on the fly?

GET Sales?$compute=Revenue sub Costs as Profit,Profit divby Revenue as Margin

Or check whether a property’s value is in a list of values?

GET People?$filter=FirstName in ('Fred','George','Harry')

When will these features be available in an OData service near you? Well, that’s an interesting question 🙂


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Syambabu Allu
      Syambabu Allu

      Good to know all new futures with OData V4.