SlideShare a Scribd company logo
1 of 35
Alok Chhabria & Kritika Goyal (SAP Labs)
July 20, 2018
ODATA V4
The new way to REST
for your applications
2
• What is ODATA?
• Improvements in ODATA V4 over ODATA V2 ?
• SAP UI5 ODATA V4 Model
• Hands-On
- Initial Setup
- Data Access and Client Server Communication
- Automatic Data Type detection
- Batch Groups
- CRUD Enablement
- ODATA Operations (If time permits)
• Q and A
AGENDA
What is ODATA?
4
WHAT is ODATA?
According to www.odata.org :
OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that
defines a set of best practices for building and consuming RESTful APIs.
OData helps you focus on your business logic while building RESTful APIs
without having to worry about the various approaches to define request and
response headers, status codes, HTTP methods, URL conventions, media
types, payload formats, query options, etc. OData also provides guidance for
tracking changes, defining functions/actions for reusable procedures, and
sending asynchronous/batch requests.
OData RESTful APIs are easy to consume. The OData metadata, a machine-
readable description of the data model of the APIs, enables the creation of
powerful generic client proxies and tools.
 Industry-standard protocol for creating and consuming data APIs
 Based on core protocols like HTTP and open standards like XML and JSON
 Enables provision of data services based on REST principles
 Initiated by Microsoft, adopted by SAP, IBM and others
 Data handling using URLs constructed with specific rules
 Defines data formats representing resources like collections, entities, properties
 Optimized for consuming data, also known as “ODBC of the web”
OData URL structure:
http://services.odata.org/Northwind/Northwind.svc/Customers?$top=3
Service Root URI Resource Path Query options
Introduction to ODATA
ODATA V4 TripPin Sample Service-
http://services.odata.org/V4/TripPinServiceRW
http://www.odata.org/odata-services/
TripPin provides a service that can manage people's trips.
Key Features :
• Person Entity People  Collection of
entity
• Friends is a Navigation Property
• Gender is Enum Property
• Loc is a Spatial Property
• Photo is a media entity
• Create Update Delete
• Batch
• Async Request
• And many more…
Data Model
ODATA V4 TripPin Sample Service
http://services.odata.org/V4/TripPinServiceRW
http://www.odata.org/odata-services/
Try it Out ! (use POSTMAN or chrome )
.
we only use the entity type Person of the TripPin service. The entities of type Person are collected in the entity set People. Each Person has a
key property UserName and the properties Age, FirstName, and LastName
Description URL
Request People
Entity
http://services.odata.org/TripPinRESTierService/People
Request Single Entity http://services.odata.org/TripPinRESTierService/People('russellwhyte')
Request Single
Property (Enum)
http://services.odata.org/TripPinRESTierService/People('russellwhyte')/Gender/$value
$filter http://services.odata.org/TripPinRESTierService/People?$filter=FirstName eq 'Scott’
Metadata http://services.odata.org/V4/TripPinService/$metadata
$orderBy http://services.odata.org/V4/TripPinService/People?$orderby=length(FirstName)
desc,UserName
ODATAV2 vs ODATAV4
What has improved in ODATA V4
Performance
 New JSON Format (data): ~ 10% to 60% payload size reduction for lists after compression
 No inline metadata
 Messages part of payload (compressible) – V2 only header (not compressible)
 Lazy loading of huge service models
 In ODATA V2 payload had to be retrieved in both XML and JSON. With V4 XML is optional.
Features
 Improved datatypes: New data types (esp. in date/time area, e.g. Duration), inheritance, collection
values
 $filter with lambda operators ”any” and “all” for conditions on navigation properties
People?$filter=Emails/any(a:endswith(a,'@example.com'))
 $expand with query options
People?$expand=Friends($filter=Emails/any(a:endswith(a,'@example.com')))
 … and many more
New JSON Format - Sample Payload V2 vs. V4
V2 Payload Northwind Order_Details
V4 Payload Northwind Order_Details
New Data Types
• Date
• Fiori: V2 only has DateTime;
workaround "ignore time" is
error prone
(time zones, accidental day shift)
• TimeOfDay, Duration
• Replacements for Edm.Time
which is a duration of max. 24
hours
Payload Example:
"DateValue": "2012-12-03"
"DateTimeOffsetValue": "2012-12-03T07:16:23Z“
Edm.Date Date without a time-zone offset
Edm.DateTimeOffset Date and time with a time-zone offset, no leap seconds
Edm.Duration Signed duration in days, hours, minutes, and (sub)seconds
Edm.TimeOfDay Clock time 00:00-23:59:59.999999999999
Payload Example:
"TimeOfDayValue": "07:59:59.999"
"DurationValue": "P12DT23H59M59.999999999999S"
• Geo types for geographic data, and corresponding $filter functions
• Ideal fit with HANA Spatial
Payload Example:
"GeographyPoint": {"type": "Point","coordinates":[142.1,64.1]}
Edm.GeographyPoint A point in a round-earth coordinate system
… …
New Data Types
UI5 ODATA Model
 The OData Model enables binding of control
properties and aggregations to data from a
remote server
 The complete dataset is stored on the server
and only the requested fields are transferred
to the client
 Currently supported versions:
sap.ui.model.odata.v2.ODataModel
sap.ui.model.odata.v4.ODataModel
(Limited Feature Scope)
UI5 Component
View
Controllers
Server-side
Model
DB data
Data Engine
ODATA Model in UI5
15
Difference in ODATA V4 and ODATA V2 Models
OData operations executed via binding: Model
does not support the method callFunction.
Simplification: Use an operation binding instead;
it is now much easier to bind operation execution
results to controls.
No CRUD methods on model: Model does not
support the
methods create, read, remove, update.
Simplification: read, update, create and remove o
perations are available implicitly via the bindings,
so that changes are bound to controls.
Minimize APIs required for batch control: Model
does not support the
methodsgetChangeBatchGroups, getChangeGro
ups, getDeferredGroups,setChangeBatchGroups,
setChangeGroups, setDeferredBatchGroups,set
DeferredGroups, setUseBatch (and
corresponding model construction parameters).
Simplification: Batch groups are solely defined via
binding parameters with the corresponding
parameters on the model as default. You just
need the submitBatchmethod on the model to
control execution of the batch.
Hands-On
Setup Development Environment
• Setup SAP Cloud Platform HANA Trial Account
(https://account.hanatrial.ondemand.com/)
• After logging in, activate Neo trial.
• Go to Connectivity -> Destinations
• Create a destination with the following configuration:
• Go to Services -> Search WebIDE -> Launch WebIDE
Step 1: The Initial App
https://openui5.hana.ondemand.com/#/topic/15d84f36c0594cb2b3295aa1f55c
b961
• Follow the steps mentioned in the tutorial given on the link
• After clicking on the above hyperlink, click on the show source code button as shown below:
• Click on Download button and follow the further steps
Step 1: The Initial App
Continued..
• Import the downloaded project
• Run the project using index.html
• Currently the project runs with Mockdata
• Go to index.html and comment the following line of code:
• This causes your requests to go to actual northwind service
• Run the app- You will see data is not loaded.
Step 1: The Initial App
Continued..
• Right click on your project. Go to NEW -> HTML5 Application Descriptor
• You have a neo-app.json file added to your project
• Add the destination configuration code to your neo-app file.
• In your manifest file change your service URI to relative URI
Instead of hardcoded (To avoid CORS issue)
• Now the requests are routed to REAL backend service via the destination configured on SCP
• We will use real service for all exercises.
• If you face issues with the real service, feel free to switch to
• Mockserver by uncommenting the code in index.html
Step 2: Data Access and Client-Server Communication
https://openui5.hana.ondemand.com/#/topic/e9de002ddf1e478fbb9232bfba83d
cf0
• Add a refresh button and refresh the model if it doesn’t have any pending changes
• Study the calls in Chrome Developer Tools Console
• For more details, follow steps in link
Step 3: Automatic datatype detection
https://openui5.hana.ondemand.com/#/topic/96bb6e06fa22491fa65a5040f6da0
99c
• Add handleValidation: true to see UI validations based on metadata information
• You can start the mockserver, update local metadata and see the changes reflect in real time without
additional UI5 coding
• For detailed steps, follow the link given above
Auto-type detection
 Derive UI5 type from $metadata
Formatting, parsing, validation between model value and UI value
 Override by specifying type in binding information
Binding mode: TwoWay is default  Changes to model written to service backend
Step 4: Filtering, Sorting and Counting
https://openui5.hana.ondemand.com/#/topic/426ff318051a465191c861b51a74f
00e
• Here we add capabilities of Sort and Filter to our applications.
• Follow the steps in the tutorial
• The REAL TRIP PIN service does not support COUNT yet. To try out the COUNT functionality, switch to
Mockserver.
Step 5: Batch Groups
https://openui5.hana.ondemand.com/#/topic/ef2af4957fae469e9203e98006d3e
e75
• Batch Groups are used to group multiple requests into one to improve overall performance.
• Follow the steps in the tutorial
• Check the Batch Request in the Chrome developer tools Console and analyze the batch requests
Process Flow for Create Implementation
Attach Controller function for Create
Event in view
Call oBinding.create method to
create a new row with blank values
Refresh the model and set focus on
the newly created row
Step 6: Create and Edit
https://openui5.hana.ondemand.com/#/topic/b4f12660538147f8839b05cb03f1d
478
Step 6: Create and Edit
Continued…
Process Flow for UI Update Implementation
Attach OnInputChange event on all
Input fields (on liveChange property)
Set the UIChanges property as true if
the event is fired
If UserName has been changed, set
property UserNameEmpty to false
(for validation purposes)
Step 6: Create and Edit
Continued…
Process Flow for Save Implementation
Add SAVE button on footer, attach
event onPress
Define success and function
handlers for the ODATA request
Save the data to your backend by
calling SubmitBatch method with
appropriate batchGroupID
Step 6: Create and Edit
Continued…
Process Flow for Reset Implementation
Add RESET button on footer, attach
event onPress
Call method ResetChanges on the
items binding of the list
Step 6: Create and Edit
Continued…
Message Handling Process Flow
Initialize MessageManager and
MessageModel
AttachChange on MessageModel
ListBinding (Filter based on technical
Messages)
Get the technical messages and
display in MessageBox
Step 7: Delete
https://openui5.hana.ondemand.com/#/topic/12a0d1ef150a42ef81e9f07fe6407
018
Steps to follow for Delete Operation
Add DELETE button on the UI and
attach OnPress event
Get Binding Context for the selected
item and call delete function of the
context
Attach Success and Error handlers
We send parameter “$AUTO” for the delete call to ensure immediate effect of the request
Ensure only one record can be
selected in your list
Step 7: OData Operations
https://openui5.hana.ondemand.com/#/topic/a3e7cb6f671b4b839f37eb5f88429
e41
Steps to follow:
Add RESTART button on the UI and attach
OnPress event
The ResetDataSource action of the TripPin
service will reset the changes made in the
model during the complete exercise
Execute the operation using execute() method,
attach relevant success and failure handlers
We use (…) syntax to make the binding DEFERRED. This way the action can be called only on explicitly calling execute() method
Call bindContext method of the model with the
relevant action name
QUIZ TIME
• How do we enable BATCH in ODATA V4 model?
• Tell one difference between ODATA V4 Model and ODATA V2 Model?
• Tell one distinct feature of ODATA V4 which wasn’t available in V2?
• How to enable deferred processing for data operations? (Syntax)
• Can we apply sort and filter together on a list using ODATA V4?
• And one more……
QUIZ TIME
Did you enjoy the session?
Please give us your valuable feedback!!
Keep RESTing the V4 way  ADIOS!
34
Any
Questions?
Ask us anything…
Thank you.
Contact information:
Alok Chhabria (alok.chhabria@sap.com)
Kritika Goyal (kritika.goyal@sap.com)

More Related Content

What's hot

COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...
COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...
COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...Jade Global
 
Presentation oracle ebs r12
Presentation oracle ebs r12Presentation oracle ebs r12
Presentation oracle ebs r12Feras Ahmad
 
Oracle Advance Pricing Demo
Oracle Advance Pricing DemoOracle Advance Pricing Demo
Oracle Advance Pricing Demogaurav.upmanyu
 
R12 fixed assets new features
R12 fixed assets new featuresR12 fixed assets new features
R12 fixed assets new featuresShuaib Kokate
 
Oracle Purchasing Internal Requisition
Oracle Purchasing Internal RequisitionOracle Purchasing Internal Requisition
Oracle Purchasing Internal RequisitionAhmed Elshayeb
 
R12 features presentation inventory management
R12 features presentation inventory managementR12 features presentation inventory management
R12 features presentation inventory managementAmine Gallah
 
BigMachines(Oracle CPQ) Yellow Belt ppt
BigMachines(Oracle CPQ) Yellow Belt pptBigMachines(Oracle CPQ) Yellow Belt ppt
BigMachines(Oracle CPQ) Yellow Belt pptRavikant K
 
OEBS R12 Presentation.ppt
OEBS R12 Presentation.pptOEBS R12 Presentation.ppt
OEBS R12 Presentation.pptMohd Haireeen
 
Oracle inventory R12 Setup Guide
Oracle inventory R12 Setup GuideOracle inventory R12 Setup Guide
Oracle inventory R12 Setup GuideAhmed Elshayeb
 
Technical architecture for order management
Technical architecture for order managementTechnical architecture for order management
Technical architecture for order managementMohit kumar Gupta
 
Oracle eBS Overview.pptx
Oracle eBS Overview.pptxOracle eBS Overview.pptx
Oracle eBS Overview.pptxssuser9dce1e1
 
Oracle ebs r12_architecture
Oracle ebs r12_architectureOracle ebs r12_architecture
Oracle ebs r12_architectureprasanna432
 
142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculations142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculationsuday reddy
 
Oracle Applications R12 architecture
Oracle Applications R12 architectureOracle Applications R12 architecture
Oracle Applications R12 architectureSekhar Byna
 
Document splitting in New GL in SAP
Document splitting in New GL in SAPDocument splitting in New GL in SAP
Document splitting in New GL in SAPRajesh Shanbhag
 

What's hot (20)

COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...
COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...
COLLABORATE 18 Presentation: Success Story- Oracle Cloud Procurement Implemen...
 
EAM Overview
EAM OverviewEAM Overview
EAM Overview
 
Presentation oracle ebs r12
Presentation oracle ebs r12Presentation oracle ebs r12
Presentation oracle ebs r12
 
Oracle Advance Pricing Demo
Oracle Advance Pricing DemoOracle Advance Pricing Demo
Oracle Advance Pricing Demo
 
oracle order management
oracle order managementoracle order management
oracle order management
 
R12 fixed assets new features
R12 fixed assets new featuresR12 fixed assets new features
R12 fixed assets new features
 
AtoM Data Migrations
AtoM Data MigrationsAtoM Data Migrations
AtoM Data Migrations
 
Oracle Purchasing Internal Requisition
Oracle Purchasing Internal RequisitionOracle Purchasing Internal Requisition
Oracle Purchasing Internal Requisition
 
R12 features presentation inventory management
R12 features presentation inventory managementR12 features presentation inventory management
R12 features presentation inventory management
 
BigMachines(Oracle CPQ) Yellow Belt ppt
BigMachines(Oracle CPQ) Yellow Belt pptBigMachines(Oracle CPQ) Yellow Belt ppt
BigMachines(Oracle CPQ) Yellow Belt ppt
 
OEBS R12 Presentation.ppt
OEBS R12 Presentation.pptOEBS R12 Presentation.ppt
OEBS R12 Presentation.ppt
 
Oracle inventory R12 Setup Guide
Oracle inventory R12 Setup GuideOracle inventory R12 Setup Guide
Oracle inventory R12 Setup Guide
 
Technical architecture for order management
Technical architecture for order managementTechnical architecture for order management
Technical architecture for order management
 
Oracle eBS Overview.pptx
Oracle eBS Overview.pptxOracle eBS Overview.pptx
Oracle eBS Overview.pptx
 
Oracle ebs r12_architecture
Oracle ebs r12_architectureOracle ebs r12_architecture
Oracle ebs r12_architecture
 
Cancellations in Order Management
Cancellations in Order ManagementCancellations in Order Management
Cancellations in Order Management
 
142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculations142500146 using-oracle-fast formula-for-payroll-calculations
142500146 using-oracle-fast formula-for-payroll-calculations
 
Oracle Applications R12 architecture
Oracle Applications R12 architectureOracle Applications R12 architecture
Oracle Applications R12 architecture
 
R12 Oracle Inventory Management, New Features
R12 Oracle Inventory Management, New FeaturesR12 Oracle Inventory Management, New Features
R12 Oracle Inventory Management, New Features
 
Document splitting in New GL in SAP
Document splitting in New GL in SAPDocument splitting in New GL in SAP
Document splitting in New GL in SAP
 

Similar to Odata V4 : The New way to REST for Your Applications

Using Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web ApplicationsUsing Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web ApplicationsNicholas Jansma
 
What's New for Developers in SharePoint 2013
What's New for Developers in SharePoint 2013What's New for Developers in SharePoint 2013
What's New for Developers in SharePoint 2013CTE Solutions Inc.
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsRandy Shoup
 
#SPSOttawa introduction to the #microsoftGraph
#SPSOttawa introduction to the #microsoftGraph#SPSOttawa introduction to the #microsoftGraph
#SPSOttawa introduction to the #microsoftGraphVincent Biret
 
Azure Application insights - An Introduction
Azure Application insights - An IntroductionAzure Application insights - An Introduction
Azure Application insights - An IntroductionMatthias Güntert
 
POST/CON 2019 Workshop: Fundamentals
POST/CON 2019 Workshop: FundamentalsPOST/CON 2019 Workshop: Fundamentals
POST/CON 2019 Workshop: FundamentalsPostman
 
Config Management and Data Service Deep Dive
Config Management and Data Service Deep DiveConfig Management and Data Service Deep Dive
Config Management and Data Service Deep DiveCristina Vidu
 
When Data Visualizations and Data Imports Just Don’t Work
When Data Visualizations and Data Imports Just Don’t WorkWhen Data Visualizations and Data Imports Just Don’t Work
When Data Visualizations and Data Imports Just Don’t WorkJim Kaplan CIA CFE
 
#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraph#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraphVincent Biret
 
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlTeamstudio
 
Monitoring modern applications: Introduction to AWS xray
Monitoring modern applications: Introduction to AWS xrayMonitoring modern applications: Introduction to AWS xray
Monitoring modern applications: Introduction to AWS xrayAmazon Web Services
 
Salesforce awesome app buildout
Salesforce awesome app buildoutSalesforce awesome app buildout
Salesforce awesome app buildoutSanjida Yasmin
 
Tech Talk on Cloud Computing
Tech Talk on Cloud ComputingTech Talk on Cloud Computing
Tech Talk on Cloud ComputingITviec
 
Effective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldEffective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldRandy Shoup
 
Tuli eServices_Mobile portfolio
 Tuli eServices_Mobile portfolio Tuli eServices_Mobile portfolio
Tuli eServices_Mobile portfolioTULI eServices Inc.
 
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas VochtenO365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas VochtenNCCOMMS
 

Similar to Odata V4 : The New way to REST for Your Applications (20)

Using Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web ApplicationsUsing Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web Applications
 
What's New for Developers in SharePoint 2013
What's New for Developers in SharePoint 2013What's New for Developers in SharePoint 2013
What's New for Developers in SharePoint 2013
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and Events
 
#SPSOttawa introduction to the #microsoftGraph
#SPSOttawa introduction to the #microsoftGraph#SPSOttawa introduction to the #microsoftGraph
#SPSOttawa introduction to the #microsoftGraph
 
Azure Application insights - An Introduction
Azure Application insights - An IntroductionAzure Application insights - An Introduction
Azure Application insights - An Introduction
 
POST/CON 2019 Workshop: Fundamentals
POST/CON 2019 Workshop: FundamentalsPOST/CON 2019 Workshop: Fundamentals
POST/CON 2019 Workshop: Fundamentals
 
Introduction to AWS X-Ray
Introduction to AWS X-RayIntroduction to AWS X-Ray
Introduction to AWS X-Ray
 
Config Management and Data Service Deep Dive
Config Management and Data Service Deep DiveConfig Management and Data Service Deep Dive
Config Management and Data Service Deep Dive
 
When Data Visualizations and Data Imports Just Don’t Work
When Data Visualizations and Data Imports Just Don’t WorkWhen Data Visualizations and Data Imports Just Don’t Work
When Data Visualizations and Data Imports Just Don’t Work
 
#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraph#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret what's new with the #MicrosoftGraph
 
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View Control
 
Monitoring modern applications: Introduction to AWS xray
Monitoring modern applications: Introduction to AWS xrayMonitoring modern applications: Introduction to AWS xray
Monitoring modern applications: Introduction to AWS xray
 
Salesforce awesome app buildout
Salesforce awesome app buildoutSalesforce awesome app buildout
Salesforce awesome app buildout
 
Tech Talk on Cloud Computing
Tech Talk on Cloud ComputingTech Talk on Cloud Computing
Tech Talk on Cloud Computing
 
Effective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldEffective Microservices In a Data-centric World
Effective Microservices In a Data-centric World
 
Tuli eServices_Mobile portfolio
 Tuli eServices_Mobile portfolio Tuli eServices_Mobile portfolio
Tuli eServices_Mobile portfolio
 
Shifan_QA_Resume
Shifan_QA_ResumeShifan_QA_Resume
Shifan_QA_Resume
 
SharePoint Custom Development
SharePoint Custom DevelopmentSharePoint Custom Development
SharePoint Custom Development
 
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas VochtenO365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
 

Recently uploaded

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 

Recently uploaded (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 

Odata V4 : The New way to REST for Your Applications

  • 1. Alok Chhabria & Kritika Goyal (SAP Labs) July 20, 2018 ODATA V4 The new way to REST for your applications
  • 2. 2 • What is ODATA? • Improvements in ODATA V4 over ODATA V2 ? • SAP UI5 ODATA V4 Model • Hands-On - Initial Setup - Data Access and Client Server Communication - Automatic Data Type detection - Batch Groups - CRUD Enablement - ODATA Operations (If time permits) • Q and A AGENDA
  • 4. 4 WHAT is ODATA? According to www.odata.org : OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs. OData helps you focus on your business logic while building RESTful APIs without having to worry about the various approaches to define request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats, query options, etc. OData also provides guidance for tracking changes, defining functions/actions for reusable procedures, and sending asynchronous/batch requests. OData RESTful APIs are easy to consume. The OData metadata, a machine- readable description of the data model of the APIs, enables the creation of powerful generic client proxies and tools.
  • 5.  Industry-standard protocol for creating and consuming data APIs  Based on core protocols like HTTP and open standards like XML and JSON  Enables provision of data services based on REST principles  Initiated by Microsoft, adopted by SAP, IBM and others  Data handling using URLs constructed with specific rules  Defines data formats representing resources like collections, entities, properties  Optimized for consuming data, also known as “ODBC of the web” OData URL structure: http://services.odata.org/Northwind/Northwind.svc/Customers?$top=3 Service Root URI Resource Path Query options Introduction to ODATA
  • 6. ODATA V4 TripPin Sample Service- http://services.odata.org/V4/TripPinServiceRW http://www.odata.org/odata-services/ TripPin provides a service that can manage people's trips. Key Features : • Person Entity People  Collection of entity • Friends is a Navigation Property • Gender is Enum Property • Loc is a Spatial Property • Photo is a media entity • Create Update Delete • Batch • Async Request • And many more… Data Model
  • 7. ODATA V4 TripPin Sample Service http://services.odata.org/V4/TripPinServiceRW http://www.odata.org/odata-services/ Try it Out ! (use POSTMAN or chrome ) . we only use the entity type Person of the TripPin service. The entities of type Person are collected in the entity set People. Each Person has a key property UserName and the properties Age, FirstName, and LastName Description URL Request People Entity http://services.odata.org/TripPinRESTierService/People Request Single Entity http://services.odata.org/TripPinRESTierService/People('russellwhyte') Request Single Property (Enum) http://services.odata.org/TripPinRESTierService/People('russellwhyte')/Gender/$value $filter http://services.odata.org/TripPinRESTierService/People?$filter=FirstName eq 'Scott’ Metadata http://services.odata.org/V4/TripPinService/$metadata $orderBy http://services.odata.org/V4/TripPinService/People?$orderby=length(FirstName) desc,UserName
  • 9. What has improved in ODATA V4 Performance  New JSON Format (data): ~ 10% to 60% payload size reduction for lists after compression  No inline metadata  Messages part of payload (compressible) – V2 only header (not compressible)  Lazy loading of huge service models  In ODATA V2 payload had to be retrieved in both XML and JSON. With V4 XML is optional. Features  Improved datatypes: New data types (esp. in date/time area, e.g. Duration), inheritance, collection values  $filter with lambda operators ”any” and “all” for conditions on navigation properties People?$filter=Emails/any(a:endswith(a,'@example.com'))  $expand with query options People?$expand=Friends($filter=Emails/any(a:endswith(a,'@example.com')))  … and many more
  • 10. New JSON Format - Sample Payload V2 vs. V4 V2 Payload Northwind Order_Details V4 Payload Northwind Order_Details
  • 11. New Data Types • Date • Fiori: V2 only has DateTime; workaround "ignore time" is error prone (time zones, accidental day shift) • TimeOfDay, Duration • Replacements for Edm.Time which is a duration of max. 24 hours Payload Example: "DateValue": "2012-12-03" "DateTimeOffsetValue": "2012-12-03T07:16:23Z“ Edm.Date Date without a time-zone offset Edm.DateTimeOffset Date and time with a time-zone offset, no leap seconds Edm.Duration Signed duration in days, hours, minutes, and (sub)seconds Edm.TimeOfDay Clock time 00:00-23:59:59.999999999999 Payload Example: "TimeOfDayValue": "07:59:59.999" "DurationValue": "P12DT23H59M59.999999999999S"
  • 12. • Geo types for geographic data, and corresponding $filter functions • Ideal fit with HANA Spatial Payload Example: "GeographyPoint": {"type": "Point","coordinates":[142.1,64.1]} Edm.GeographyPoint A point in a round-earth coordinate system … … New Data Types
  • 14.  The OData Model enables binding of control properties and aggregations to data from a remote server  The complete dataset is stored on the server and only the requested fields are transferred to the client  Currently supported versions: sap.ui.model.odata.v2.ODataModel sap.ui.model.odata.v4.ODataModel (Limited Feature Scope) UI5 Component View Controllers Server-side Model DB data Data Engine ODATA Model in UI5
  • 15. 15 Difference in ODATA V4 and ODATA V2 Models OData operations executed via binding: Model does not support the method callFunction. Simplification: Use an operation binding instead; it is now much easier to bind operation execution results to controls. No CRUD methods on model: Model does not support the methods create, read, remove, update. Simplification: read, update, create and remove o perations are available implicitly via the bindings, so that changes are bound to controls. Minimize APIs required for batch control: Model does not support the methodsgetChangeBatchGroups, getChangeGro ups, getDeferredGroups,setChangeBatchGroups, setChangeGroups, setDeferredBatchGroups,set DeferredGroups, setUseBatch (and corresponding model construction parameters). Simplification: Batch groups are solely defined via binding parameters with the corresponding parameters on the model as default. You just need the submitBatchmethod on the model to control execution of the batch.
  • 17. Setup Development Environment • Setup SAP Cloud Platform HANA Trial Account (https://account.hanatrial.ondemand.com/) • After logging in, activate Neo trial. • Go to Connectivity -> Destinations • Create a destination with the following configuration: • Go to Services -> Search WebIDE -> Launch WebIDE
  • 18. Step 1: The Initial App https://openui5.hana.ondemand.com/#/topic/15d84f36c0594cb2b3295aa1f55c b961 • Follow the steps mentioned in the tutorial given on the link • After clicking on the above hyperlink, click on the show source code button as shown below: • Click on Download button and follow the further steps
  • 19. Step 1: The Initial App Continued.. • Import the downloaded project • Run the project using index.html • Currently the project runs with Mockdata • Go to index.html and comment the following line of code: • This causes your requests to go to actual northwind service • Run the app- You will see data is not loaded.
  • 20. Step 1: The Initial App Continued.. • Right click on your project. Go to NEW -> HTML5 Application Descriptor • You have a neo-app.json file added to your project • Add the destination configuration code to your neo-app file. • In your manifest file change your service URI to relative URI Instead of hardcoded (To avoid CORS issue) • Now the requests are routed to REAL backend service via the destination configured on SCP • We will use real service for all exercises. • If you face issues with the real service, feel free to switch to • Mockserver by uncommenting the code in index.html
  • 21. Step 2: Data Access and Client-Server Communication https://openui5.hana.ondemand.com/#/topic/e9de002ddf1e478fbb9232bfba83d cf0 • Add a refresh button and refresh the model if it doesn’t have any pending changes • Study the calls in Chrome Developer Tools Console • For more details, follow steps in link
  • 22. Step 3: Automatic datatype detection https://openui5.hana.ondemand.com/#/topic/96bb6e06fa22491fa65a5040f6da0 99c • Add handleValidation: true to see UI validations based on metadata information • You can start the mockserver, update local metadata and see the changes reflect in real time without additional UI5 coding • For detailed steps, follow the link given above Auto-type detection  Derive UI5 type from $metadata Formatting, parsing, validation between model value and UI value  Override by specifying type in binding information Binding mode: TwoWay is default  Changes to model written to service backend
  • 23. Step 4: Filtering, Sorting and Counting https://openui5.hana.ondemand.com/#/topic/426ff318051a465191c861b51a74f 00e • Here we add capabilities of Sort and Filter to our applications. • Follow the steps in the tutorial • The REAL TRIP PIN service does not support COUNT yet. To try out the COUNT functionality, switch to Mockserver.
  • 24. Step 5: Batch Groups https://openui5.hana.ondemand.com/#/topic/ef2af4957fae469e9203e98006d3e e75 • Batch Groups are used to group multiple requests into one to improve overall performance. • Follow the steps in the tutorial • Check the Batch Request in the Chrome developer tools Console and analyze the batch requests
  • 25. Process Flow for Create Implementation Attach Controller function for Create Event in view Call oBinding.create method to create a new row with blank values Refresh the model and set focus on the newly created row Step 6: Create and Edit https://openui5.hana.ondemand.com/#/topic/b4f12660538147f8839b05cb03f1d 478
  • 26. Step 6: Create and Edit Continued… Process Flow for UI Update Implementation Attach OnInputChange event on all Input fields (on liveChange property) Set the UIChanges property as true if the event is fired If UserName has been changed, set property UserNameEmpty to false (for validation purposes)
  • 27. Step 6: Create and Edit Continued… Process Flow for Save Implementation Add SAVE button on footer, attach event onPress Define success and function handlers for the ODATA request Save the data to your backend by calling SubmitBatch method with appropriate batchGroupID
  • 28. Step 6: Create and Edit Continued… Process Flow for Reset Implementation Add RESET button on footer, attach event onPress Call method ResetChanges on the items binding of the list
  • 29. Step 6: Create and Edit Continued… Message Handling Process Flow Initialize MessageManager and MessageModel AttachChange on MessageModel ListBinding (Filter based on technical Messages) Get the technical messages and display in MessageBox
  • 30. Step 7: Delete https://openui5.hana.ondemand.com/#/topic/12a0d1ef150a42ef81e9f07fe6407 018 Steps to follow for Delete Operation Add DELETE button on the UI and attach OnPress event Get Binding Context for the selected item and call delete function of the context Attach Success and Error handlers We send parameter “$AUTO” for the delete call to ensure immediate effect of the request Ensure only one record can be selected in your list
  • 31. Step 7: OData Operations https://openui5.hana.ondemand.com/#/topic/a3e7cb6f671b4b839f37eb5f88429 e41 Steps to follow: Add RESTART button on the UI and attach OnPress event The ResetDataSource action of the TripPin service will reset the changes made in the model during the complete exercise Execute the operation using execute() method, attach relevant success and failure handlers We use (…) syntax to make the binding DEFERRED. This way the action can be called only on explicitly calling execute() method Call bindContext method of the model with the relevant action name
  • 32. QUIZ TIME • How do we enable BATCH in ODATA V4 model? • Tell one difference between ODATA V4 Model and ODATA V2 Model? • Tell one distinct feature of ODATA V4 which wasn’t available in V2? • How to enable deferred processing for data operations? (Syntax) • Can we apply sort and filter together on a list using ODATA V4? • And one more……
  • 33. QUIZ TIME Did you enjoy the session? Please give us your valuable feedback!! Keep RESTing the V4 way  ADIOS!
  • 35. Thank you. Contact information: Alok Chhabria (alok.chhabria@sap.com) Kritika Goyal (kritika.goyal@sap.com)