0% found this document useful (0 votes)
3K views3 pages

Summary of Differences Between OData V2 and V4 - SAP Help Portal

The document outlines key differences between OData v2 and v4 protocols. Some differences include v4 supporting JSON metadata format and PATCH method for merging records, while v2 uses POST and custom header. V4 also allows query options on expanded entities and supports instance annotations in responses.

Uploaded by

geethashriit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views3 pages

Summary of Differences Between OData V2 and V4 - SAP Help Portal

The document outlines key differences between OData v2 and v4 protocols. Some differences include v4 supporting JSON metadata format and PATCH method for merging records, while v2 uses POST and custom header. V4 also allows query options on expanded entities and supports instance annotations in responses.

Uploaded by

geethashriit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2/7/24, 7:06 PM Summary of Differences Between OData V2 and V4 | SAP Help Portal

Help Portal
Browse by Product SAP Learning Journeys What's New Explore SAP
(Documentation)

Home  SAP SuccessFactors Platform  SAP SuccessFactors API Reference Guide (OData V4)  Summary of Differences Between OData V2 and V4

SAP SuccessFactors This document ▼ Search in this document 


API Reference  Advanced Search

Guide (OData V4)


  Favorite  Download PDF  Share 

Summary of Differences Between OData V2 and V4


Learn about the differences between OData v2 and v4 protocols in SAP SuccessFactors.

Differences Between OData v2 and v4

Capability OData v2 OData v4

Metadata Supports XML format only Supports both XML and JSON formats

XML: /odatav4/Sample.svc/v1/$metadata

XML: /odatav4/Sample.svc/v1/$metadata?$format=JSON

Metadata Supports single, full, and comma-delimited metadata Supports metadata query on service level only.
Scope queries, examples:

Single: /odata/v2/User/$metadata

Full: /odata/v2/User/$metadata

Comma-delimited: /odata/v2/User,
Picklist/$metadata

Data Type Supports the following data types: Supports the following data types:

DateTime Date

Time TimeofDay

Float Single

Enum

Merge OData v2 uses HTTP method POST and HTTP header X- In OData v4, you can use the PATCH HTTP method to merge records.
Operation HTTP-METHOD: MERGE to merge records.

Upsert Supports SAP-proprietary function import Not supported


/odata/v2/upsert with HTTP method POST

Function Uses HTTP method GET for read operations. Uses HTTP method GET for function imports (read operations).
import and
Uses HTTP method POST for write operations. Uses HTTP method POST for function imports (write operations).
action
import No action imports. OData v4 also supports resource-bound functions and actions.

Entity Supports entity referencing operations with $link $ref isn't supported yet.
reference

Server-side Supports cursor-based and snapshot-based pagination Not supported


pagination

Query System query options are supported only at root entity level, Supports system query options on aggregated entities:
resources for example, $filter, $select, and $orderby.
/odata/v4/User('admin')/reports?$filter=username eq 'abc'

https://help.sap.com/docs/SAP_SUCCESSFACTORS_PLATFORM/9f5f060351034d98990213d077dab38a/eb5d246dc27046eba4d14b7b73e74a… 1/3
2/7/24, 7:06 PM Summary of Differences Between OData V2 and V4 | SAP Help Portal

Capability Help Portal


OData v2 OData v4
SAP Learning Journeys What's New
(Documentation)

In this example, the filter condition applies to all users whose manager i
'admin'.

System Applies to root entities only, for example: Can be used to query both root and expanded entities:
query
/odata/v2/User?$filter=username eq 'abc' /odatav4/User?
option
$select=username&$expand=reports($select=username)
$select Nested filters can be used in a one-to-many relationship:

/odata/v2/User?$filter=reports/username eq
'abc'

Supports custom binary operators

System Applies to root entities only. Can be used to query both root and expanded entities:
query Nested filters can be applied to navigation properties /odatav4
option with a one-to-many relationship:
$filter Nested filters can be applied to entities of one-to-many relationship
/odata/v2/User?$filter=reports/username eq lambda expressions such as any and all:
'abc'
$filter=user=reports/any(m:m/username eq 'abc'
Supports customized operators such as like and in
Customized operators aren’t supported.
datetimeoffset must be specified in expression before
a DateTimeOffset field type: DateTimeOffset field type can be filtered without datetimeoffset:

$filter=lastModifed gt '2020-05-20T00:00:00Z'
$filter=lastModifed gt datetimeoffset'2020-05-
20T00:00:00Z' Supports method expression contains (v4 only):

Supports method expression replace (v2 only): $filter=contains(username, 'abc')

$filter=replace(username, 'abc', 'def') eq


'hdef'

System Supports deep expand: Supports deep expand and query options in expanded entities:
query
/odata/v2/User?$expand=reports,reports/reports /odatav4/User?$expand=reports($expand=reports)
option
$expand /odatav4/User?$expand=reports($filter=username eq 'abc';
$select=username)

Default ATOM JSON


response
format

Instance Not supported Annotations are supported as an extended feature in OData v4. Annotat
annotations start with $:
in response
{
"@context": "$metadata#Customers",
"@com.example.customer.setkind": "VIPs",
"value": [
{
"@com.example.display.highlight": true,
"ID": "ALFKI",
"[email protected]":
{
"title": true,
"order": 1
},
"CompanyName": "Alfreds Futterkiste",
"[email protected]#simple":
{
"order": 2
}
}

https://help.sap.com/docs/SAP_SUCCESSFACTORS_PLATFORM/9f5f060351034d98990213d077dab38a/eb5d246dc27046eba4d14b7b73e74a… 2/3
2/7/24, 7:06 PM Summary of Differences Between OData V2 and V4 | SAP Help Portal

Capability Help Portal


OData v2 OData v4
SAP Learning Journeys What's New
(Documentation)

]
}

Error OData v2 error response example: OData v4 error response example:


response {  {
"error": {  "error": {
"code": "BadRequest", "code": "BadArgument",
"message": { "message": "Please check your inputs",
"lang": "en", "details": [
"value": "Unsupported functionality" {
} "code": "NameRequired",
} "message": "Name must not be empty",
"target": "name"
},
{
"code": "PasswordNotMeetPolicy",
"message": "Password must have one upper case".
"target": "password"
}
]
}
}

Framework- No Yes. See Service Limits.


level
access
limits
Was this page helpful? 

Yes No

Copyright Disclaimer Privacy Statement Legal Disclosure Trademark System Status Ask a question about the SAP Help Portal

Terms of Use Cookie Preferences Accessibility and Sustainability

Find us on Share 

https://help.sap.com/docs/SAP_SUCCESSFACTORS_PLATFORM/9f5f060351034d98990213d077dab38a/eb5d246dc27046eba4d14b7b73e74a… 3/3

You might also like