odata · sap netweaver gateway sap openui5 sap “sap netweaver gateway provides an api that is...

42
OData The best way to REST Sam Xu Software Engineer II Microsoft

Upload: others

Post on 03-Jul-2020

62 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

ODataThe best way to REST

Sam Xu

Software Engineer II

Microsoft

Page 2: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

• SDE II at Microsoft Shanghai ZiZhu

• Almost 4 Years in Microsoft

• 3+ years in OData Team

• Focus on ODL, Web API OData

• http://github.com/xuzhg

About me

Page 3: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Agenda

• What is OData?

• Where is OData?

• Who provides OData?

• Why choose OData?

Page 4: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

What is OData?

Page 5: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Web Services – SOAP vs REST

SOAP REST

Overhead Heavyweight Lightweight

Metadata Complex Simple

Operations SOAP envelope HTTP VERB (Get, Post…)

Resource identity SOAP envelope HTTP URI

• REST: Representational State Transfer• SOAP: Simple Object Access Protocol

Page 6: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Open Data Protocol (OData)

• An open protocol of OASIS standard to allow the creation and consumption of queryable and interoperable RESTful APIs in

a simple and standard way.[ ]• OASIS standard (2014/3/17)• HTTP Request/Response, Method, Status codes, etc• Entity Data Model (EDM)• JavaScript Object Notation (JSON)• Rich Query Options ($filter, $expand, etc)• ……

Page 7: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData Spec

http://odata.org

Page 8: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Where is OData?

Page 9: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Microsoft

Microsoft

Office 365 API

Azure APIsExcel and

PowerQuery

“The Office 365 APIs follow REST and OData 4.0 standards for data transport, and use the OAuth 2.0 standard for authentications and authorization.”

“Azure Search service API uses Open Data Protocol (OData) for index queries. Azure Search supports OData version 4.”

“Microsoft Power Query for Excel’s OData V4 support leverages the built-in functionality of the OData service to bring only the relevant data back into Excel. ”

More …

Page 10: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

SAP NetWeaver Gateway SAP OpenUI5

SAP

“SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

“It eases your development with a client-side HTML5 rendering library including a rich set of controls and supports data binding to different models (JSON, XML and OData).”

Page 11: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Salesforce’s OData product:

Lightning Connect & DataDirect Cloud

“With external objects you can connect to an external data source like SAP or any other database that uses OData protocol or a simple URL.”

Page 12: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Who provides OData?

Page 13: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData libraries by Microsoft

Source: https://github.com/OData/Document: http://odata.github.io/

Page 14: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData libs on Nuget.org

Page 15: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData libraries by Apache

http://olingo.apache.org/

Page 16: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData libraries by JayData

http://jaydata.org/

Page 17: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData libraries by Breeze

http://www.getbreezenow.com/documentation/odata

Page 18: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Why choose OData?

Page 19: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Advantages

OData

OpenStandard

Interoperability

RESTfulness

Queryability

Industry practice

Community

Page 20: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData is an open standard

Page 21: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Standardization history

V1.0 (2007)

V2.0 (2009)

V3.0 (2012)

V4.0 (2014) V4.0 (will submit to ISO this year)

Page 22: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData OASIS TC participants

Page 23: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData provides interoperability

Page 24: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Openness leads to interoperability

Agreed resource identification method

Agreed resource representation

Agreed resource operation

Page 25: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData APIs are RESTful

Page 26: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData follows REST principles

Page 27: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData provides API queryability

Page 28: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Rich system query options

• To narrow the result set$filter

• To narrow the set of properties$select

• To do client side paging$top and $skip

• To sort the result set$orderby

• To take advanced results$count, $search,

$value, $format…

Page 29: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData represents industry practices

Page 30: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Specification covering every aspect of REST

Model representation

Batch & asynchronous

requests

VersioningChange

requesting

URL conventions

Queries OperationsData

annotation…

Entity Data model

Http Verbs

Context URL

OData Version

Query Options

Page 31: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Industry practices in different businesses

Enterprises

• Microsoft

• SAP

• Salesforce

• IBM

• Schneider

Electrics

SaaS providers

• Blue garden

• K2

• Creditpoint

• Questionmark

• Splunk

Integration service

providers

• Jitterbit

• ODataHQ

• Mulesoft

• Juhe Data (聚合

数据)

• Progress software

Library and tooling

implementers

• JayData

• Apache

• Breeze

• Gizur

• Pragmatiqa

• Tableau

http://www.OData.org/ecosystem/

Page 32: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData has a prosperous community

Page 33: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Three personas and their needs

RESTful API/client

Developers

• Tutorials

• Documentations

• Community

• Libraries

• Tooling

Business decision

makers

• Success stories

• Customers

• Business benefits

API advocates

• A good protocol

to advocate and

learn from

• Everything the

first two

personas need

Source Codes

Page 34: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Home of the OData community

http://www.odata.org/

Page 35: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

DEMO

Page 36: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Basic OData URI examples

http://services.odata.org/V4/TripPinService

http://services.odata.org/V4/TripPinService/$metadata

http://services.odata.org/V4/TripPinService/People

http://services.odata.org/V4/TripPinService/People('russellwhyte')

Page 37: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Advance Query option examples

http://services.odata.org/V4/TripPinService/People?$filter=startswith(LastName,'A')

http://services.odata.org/V4/TripPinService/People?$select=UserName

http://services.odata.org/V4/TripPinService/People?$top=2&$skip=1

http://services.odata.org/V4/TripPinService/People?$orderby=FirstName%20desc

http://services.odata.org/V4/TripPinService/People?$filter=Friends/any(e0:startswith(e0/FirstName,'W') and Friends/any(e1:(LastName eq 'Alfred')))&$select=UserName,Friends

Page 38: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Summary

Page 39: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

OData - The best way to REST

• Open protocol, open source libraries, open

communityOpen

• Protocol built on REST principlesRESTful

• Available on any device, any platform, anywhereUbiquitous

• Build on industry best practices, supported and

used by Enterprises that serves billions of usersPractical

Page 40: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Resources

• OData communityHome: • http://www.OData.org

• OASIS OData TC Home: • https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=OData

• OData on GitHub: • https://github.com/OData/

• OData V4 sample servicesTripPin (read & write):• http://services.OData.org/V4/TripPinServiceRW

• OData team of MicrosoftMail to: • [email protected]

Page 41: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Go to:

Page 42: OData · SAP NetWeaver Gateway SAP OpenUI5 SAP “SAP NetWeaver Gateway provides an API that is designed to function in just such a manner; and it does so using the OData protocol.”

Thank You!