REST WEB SERVICES
Mahek
WHAT IS WEB API?
• API(Application Programming Interface) is a interface between two
software which allows interaction between each other.
• It is a messenger, which receives the request for services, send it to
the server and finally respond it to the client.
• E.g. Consider a restaurant where customer(Client), who orders the
food to the waiter(API), and kitchen room(Server) receives the order
and delivers the food.
RESTAURANT
Client
API
K
i
t
c
h
e
n
WHY API’S?
• We need a service for any device with front end
o Easy
o Simple
o Lightweight
o All features of HTTP
• ReST-ful(Representational State Transfer) Services fulfill all the
above needs.
Need of API’s
INTRODUCTION TO REST
• It is an architectural pattern for developing web services as opposed
to a specification.
• REST architectures are realized by applying specific interaction
constraints such as performance, reliability, scalability, simplicity,
modifiability, visibility and portability.
• Web service API’s that adheres to REST architectural constraints are
RESTful Web API’s
INTRODUCTION TO REST
• REST web services communicate over the HTTP specification, using
HTTP vocabulary:
o Methods (GET, POST, etc.)
o HTTP URI syntax (paths, parameters, etc.)
o Media types (xml, json, html, plain text, etc)
o HTTP Response codes.
INTRODUCTION TO REST
• Representational
o Clients possess the information necessary to identify, modify, and/or delete a
web resource.
• State
o All resource state information is stored on the client.
• Transfer
o Client state is passed from the client to the service through HTTP.
INTRODUCTION TO REST
The six characteristics of REST:
1. Uniform interface
2. Decoupled client-server interaction
3. Stateless
4. Cacheable
5. Layered
6. Extensible through code on demand (optional)
*Services that do not conform to the above required constraints
are not strictly RESTful web services.
HTTP-REST REQUEST BASICS
• The HTTP request is sent from the client.
o Identifies the location of a resource.
o Specifies the verb, or HTTP method to use when accessing the
resource.
o Supplies optional request headers (name-value pairs) that
provide additional information the server may need when
processing the request.
o Supplies an optional request body that identifies additional data to
be uploaded to the server (e.g. form parameters, attachments, etc.)
HTTP-REST REQUEST BASICS
• A typical client GET request:
• A typical client POST request:
POST /save HTTP/1.1
User-Agent: IE
Content-Type: application/x-www-form-urlencoded
[CRLF]
name=x&id=2
Requested Resource (path and query string)
Request Headers
(no request body)
Requested Resource (typically no query string)
Request
Headers
Request Body (e.g. form parameters)
HTTP-REST RESPONSE BASICS
• The HTTP response is sent from the server.
o Gives the status of the processed request.
o Supplies response headers (name-value pairs) that provide
additional information about the response.
o Supplies an optional response body that identifies additional data
to be downloaded to the client (html, xml, binary data, etc.)
HTTP-REST RESPONSE BASICS
• Sample Server Responses:
HTTP/1.1 500 Internal Server Error
HTTP/1.1 201 Created
Location: /view/7
[CRLF]
Some message goes here.
Response StatusHTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1337
[CRLF]
<html>
<!-- Some HTML Content. -->
</html>
Response Headers
Response Body (content)
Response Status
Response Status
Response Header
Response Body
Response Status
HTTP-REST VOCABULARY
HTTP Methods supported by REST:
• GET – Requests a resource at the request URL
o Should not contain a request body, as it will be discarded.
o May be cached locally or on the server.
o May produce a resource, but should not modify on it.
• POST – Submits information to the service for processing
o Should typically return the new or modified resource.
• PUT – Add a new resource at the request URL
• DELETE – Removes the resource at the request URL
• OPTIONS – Indicates which methods are supported
• HEAD – Returns meta information about the request URL
HTTP-REST VOCABULARY
A typical HTTP REST URL:
• The protocol identifies the transport scheme that will be used to process and respond to
the request.
• The host name identifies the server address of the resource.
• The path and query string can be used to identify and customize the accessed resource.
http://my.store.com/fruits/list?category=fruit&limit=20
protocol host name path to a
resource
query string
HTTP AND REST
A REST service framework provides a controller for routing HTTP
requests to a request handler according to:
• The HTTP method used (e.g. GET, POST)
• Supplied path information (e.g /service/listItems)
• Query, form, and path parameters
• Headers, cookies, etc.
ROUTING IN WEB API
Characteristics of routing in Web API:
• We can use API controller names and a naming convention for
actions to route Web API requests
• Alternatively we can use the following attributes to control the
mapping of HTTP requests (HTTP Verb+URL) to actions in the
controller:
• The HttpGet, HttpPut, HttpPost, or HttpDelete attributes
• The AcceptVerbs attribute
• The ActionName attribute
CREATING A WEB API FOR AN MVC 4
WEB APPLICATION
To create a Web API for a an MVC4 application:
1. Implement a Web API template in your project:
o In the New Project dialog box, click ASP.NET MVC 4 Web Application
o In the Select a Template box of the New ASP.NET MVC 4 Project dialog box, click Web
API
2. Add an MVC API controller class to the project:
o Hosts application code for handling requests
o Derives from the ApiController base class
3. Add action methods to the controller class
USING ROUTES AND CONTROLLERS
IN WEB API’S
Routing in ASP.NET MVC4 applications involves the following:
• ASP.NET adds a default route to:
o Map a URL and a controller
o Support the operations of the REST-style Web APIs
• We can modify the default route to include multiple actions in the
same HTTP method
• We can use the WebApiConfig class to:
o Modify the routing
o Enable multiple versions of API to coexist in the same project
DEMO
Implementing Web API
SECURITY
Basically we require two techniques to make our WebApi more
secure:
o Authentication
o Authorization
o Maintaining Session
SECURITY
Basic Authentication
o Basic authentication is a mechanism, where an end user gets
authenticated through our service i.e. RESTful service with the help
of plain credentials such as user name and password.
o An end user makes a request to the service for authentication with
user name and password embedded in request header.
o Service receives the request and checks if the credentials are valid
or not, and returns the response accordingly, in case of invalid
credentials, service responds with 401 error code i.e. unauthorized.
BASIC AUTHENTICATION
SECURITY
Token Based Authorization
o Authorization part comes just after authentication, once
authenticated a service can send a token to an end user through
which user can access other resources.
o The token could be any encrypted key, which only server/service
understands and when it fetches the token from the request made by
end user, it validates the token and authorizes user into the system
o Token can have its own lifetime, and may expire accordingly
TOKEN BASED AUTHORIZATION
MAINTAINING SESSION
• We can maintain sessions using Token based Authorization.
• An authenticated user will be allowed to access resources for a
particular period of time, and can re-instantiate the request with an
increased session time delta to access other resource or the same
resource.
• We may need to implement login/logout for a user, to maintain
sessions for the user, to provide roles and permissions to their user,
all these features could be achieved using basic authentication and
token based authorization.
CACHING
• HTTP caches can store copies of responses
• Useful for reducing:
o Network traffic
o Server workload
o Call latency
• Caches are a main factor for scalability on the web
CACHE-HEADERS
• Cache-Control
o no-cache (Default): Response may be cached, but revalidated on next request
o no-store: Do not store a local copy
o max-age: Set TTL, in seconds
o private: Do not store in proxies
• Expires
o Default value: -1 (expired)
o Specify date of expiration (UTC, up to a year from today)
o max-age takes precedence
• While a resource is cached and hasn’t expired, no request is sent to
the server
CACHING
• ETag (entity tag) contains a resource’s version
• Can be a hash, timestamp, version number, GUID, …
• First time:
Client
sends a request
Server adds ETag
header to response
Client caches
response with ETag
CACHING
• ETag (entity tag) contains a resource’s version
• Can be a hash, timestamp, version number, GUID, …
• Subsequent calls:
Client sends a
request with ETag
Server compares
ETag to resource’s
version
Respond with
HTTP 304
(Unmodified)
Respond with the
updated resource
and Etag
Client caches
response with
ETag
REST SERVICES OVER SOAP
REST is easier to use for the most part and is more flexible. It has the following
advantages when compared to SOAP:
o No expensive tools require to interact with the Web service
o REST is lightweight as compare to SOAP
o Smaller learning curve
o Efficient (SOAP uses XML for all messages, REST can use smaller message formats)
o Fast (no extensive processing required)
o Closer to other Web technologies in design philosophy
ODATA
• Open Data protocol(OData) is an open protocol for sharing data.
• It is built upon AtomPub, itself an extension of Atom Publishing
Protocol.
• Odata is based on REST; therefore a simple web browser can view
the data exposed through an Odata service.
• It not only allows read access but also whole set of CRUD
operations.
HOW ODATA WORKS
• OData has four main parts:
1. OData data model
2. OData protocol
3. OData client libraries
4. OData service
REQUESTING RESOURCES
• As an example we use the service of an open trip management system.
• If a person named Russell White, who has formerly registered at Tripin,
would like to find out who are the other people in it.
INTERNAL WORKING
RESPONSE
REQUESTING RESOURCES
• By Individual resource
url: serviceRoot/People(‘Mahek’)
• By Individual property
url: serviceRoot/Airports(‘IGI’)/Name
• By Individual property Raw Value
url: serviceRoot/Airports(‘IGI’)/Name/$value
QUERYING DATA
• OData supports various kinds of query options for querying data.
• Example:
DATA MODIFICATION
• Creating a resource
Request Response
DATA MODIFICATION
• Deleting a resource
Request : DELETE serviceRoot/People(‘Mahek’)
Response:
HTTP/1.1 204 No Content
DATA MODIFICATION
• Updating a resource
Request Response
DATA MODIFICATION
• Relationships from one entity to another are represented as
navigation properties.
• Example: Here two persons are related by friendship.
DATA MODIFICATION
Invoking Function
• OData supports defining functions to represent complicated logic
which can be frequently used.
• Example
After having explored the TripPin OData service, Russell finds out
that it has a function called GetInvolvedPeople from which he can
find out the involved people of specific trip.
ADVANCED FEATURES
• Singleton
• Derived Entity Type
• Batch
THANK YOU……

More Related Content

PPTX
Rest APIs Training
PPTX
Overview of RESTful web services
PPTX
Intro to flask2
PPTX
Servletarchitecture,lifecycle,get,post
PPTX
Introduction to API and Service Hosting 3.7
PPTX
SFDC Outbound Integrations
PPTX
HTTP fundamentals for developers
PDF
HTML5 Server Sent Events/JSF JAX 2011 Conference
Rest APIs Training
Overview of RESTful web services
Intro to flask2
Servletarchitecture,lifecycle,get,post
Introduction to API and Service Hosting 3.7
SFDC Outbound Integrations
HTTP fundamentals for developers
HTML5 Server Sent Events/JSF JAX 2011 Conference

What's hot (19)

PPTX
introduction for web connectivity (IoT)
PPT
Web services - REST and SOAP
PPTX
Rest & RESTful WebServices
ODP
Apache ppt
PPTX
Httpbasics 1207412539273264-9-converted
PPTX
Application layer protocols
PPTX
The ASP.NET Web API for Beginners
PPT
Server side
PPTX
Web technology Unit-I Part D - message format
PPTX
web connectivity in IoT
PPTX
Hypertex transfer protocol
PDF
OAuth: Trust Issues
PDF
Understanding the Web through HTTP
PPTX
PPTX
RESTful modules in zf2
KEY
Web API Basics
PPTX
6 Months Industrial Training in Spring Framework
PDF
Design patternsforiot
PPT
Fm 2
introduction for web connectivity (IoT)
Web services - REST and SOAP
Rest & RESTful WebServices
Apache ppt
Httpbasics 1207412539273264-9-converted
Application layer protocols
The ASP.NET Web API for Beginners
Server side
Web technology Unit-I Part D - message format
web connectivity in IoT
Hypertex transfer protocol
OAuth: Trust Issues
Understanding the Web through HTTP
RESTful modules in zf2
Web API Basics
6 Months Industrial Training in Spring Framework
Design patternsforiot
Fm 2

Viewers also liked (11)

PDF
Rhubee Neale18Dec 2016 CV
PDF
willemart_reference
PDF
KU Leuven Reference
PDF
Using Infra-Red (IR) Heaters To Provide Targeted Energy Efficient Hazardous A...
PDF
Travel Addicts - Corporate Events
PDF
Roxtec : Semisubmersibles
PDF
Alterenergy - Energy Sustainability Planning Recommendation and Guidelines
PPTX
Microsoft CRM Features – What’s New with Dynamics CRM 2016? | BDO Connections...
PDF
20161210_新趨勢報告_互聯網醫療保險
PDF
2016/3/12 個股研究(寶成)
PDF
20161125_新趨勢報告_Blockchain
Rhubee Neale18Dec 2016 CV
willemart_reference
KU Leuven Reference
Using Infra-Red (IR) Heaters To Provide Targeted Energy Efficient Hazardous A...
Travel Addicts - Corporate Events
Roxtec : Semisubmersibles
Alterenergy - Energy Sustainability Planning Recommendation and Guidelines
Microsoft CRM Features – What’s New with Dynamics CRM 2016? | BDO Connections...
20161210_新趨勢報告_互聯網醫療保險
2016/3/12 個股研究(寶成)
20161125_新趨勢報告_Blockchain

Similar to Rest WebAPI with OData (20)

PDF
REST API Recommendations
PDF
Api design and development
PPTX
API Testing Using REST Assured with TestNG
PPTX
Rest webservice ppt
PPTX
ASP.NET Mvc 4 web api
PPTX
SCWCD : The web client model : CHAP : 1
PPTX
Rest API Testing
PDF
restapitest-anil-200517181251.pdf
PPTX
SCWCD : The web client model
PDF
Ch 3: Web Application Technologies
PPT
Ch-1_.ppt
PDF
Angular - Chapter 7 - HTTP Services
PPTX
REST & RESTful Web Service
PDF
Simplify QA Automation: Master API Testing with HTTPClient in C#
PPTX
PDF
CNIT 129S - Ch 3: Web Application Technologies
PPTX
Compute rNetwork.pptx
PPTX
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
PPTX
Mini-Training: Let's have a rest
PDF
Best Practices in Web Service Design
REST API Recommendations
Api design and development
API Testing Using REST Assured with TestNG
Rest webservice ppt
ASP.NET Mvc 4 web api
SCWCD : The web client model : CHAP : 1
Rest API Testing
restapitest-anil-200517181251.pdf
SCWCD : The web client model
Ch 3: Web Application Technologies
Ch-1_.ppt
Angular - Chapter 7 - HTTP Services
REST & RESTful Web Service
Simplify QA Automation: Master API Testing with HTTPClient in C#
CNIT 129S - Ch 3: Web Application Technologies
Compute rNetwork.pptx
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
Mini-Training: Let's have a rest
Best Practices in Web Service Design

Recently uploaded (20)

PDF
1_Keynote_Breaking Barriers_한계를 넘어서_Charith Mendis.pdf
PDF
State of AI in Business 2025 - MIT NANDA
PDF
substrate PowerPoint Presentation basic one
PDF
Fitaura: AI & Machine Learning Powered Fitness Tracker
PDF
Revolutionizing recommendations a survey: a comprehensive exploration of mode...
PPTX
From XAI to XEE through Influence and Provenance.Controlling model fairness o...
PPTX
AQUEEL MUSHTAQUE FAKIH COMPUTER CENTER .
PDF
Altius execution marketplace concept.pdf
PDF
Domain-specific knowledge and context in large language models: challenges, c...
PDF
Examining Bias in AI Generated News Content.pdf
PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PDF
Ebook - The Future of AI A Comprehensive Guide.pdf
PPTX
How to use fields_get method in Odoo 18
PDF
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
PDF
Intravenous drug administration application for pediatric patients via augmen...
PDF
NewMind AI Journal Monthly Chronicles - August 2025
PDF
Addressing the challenges of harmonizing law and artificial intelligence tech...
PDF
Human Computer Interaction Miterm Lesson
PPT
Overviiew on Intellectual property right
PDF
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf
1_Keynote_Breaking Barriers_한계를 넘어서_Charith Mendis.pdf
State of AI in Business 2025 - MIT NANDA
substrate PowerPoint Presentation basic one
Fitaura: AI & Machine Learning Powered Fitness Tracker
Revolutionizing recommendations a survey: a comprehensive exploration of mode...
From XAI to XEE through Influence and Provenance.Controlling model fairness o...
AQUEEL MUSHTAQUE FAKIH COMPUTER CENTER .
Altius execution marketplace concept.pdf
Domain-specific knowledge and context in large language models: challenges, c...
Examining Bias in AI Generated News Content.pdf
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
Ebook - The Future of AI A Comprehensive Guide.pdf
How to use fields_get method in Odoo 18
ELLIE29.pdfWETWETAWTAWETAETAETERTRTERTER
Intravenous drug administration application for pediatric patients via augmen...
NewMind AI Journal Monthly Chronicles - August 2025
Addressing the challenges of harmonizing law and artificial intelligence tech...
Human Computer Interaction Miterm Lesson
Overviiew on Intellectual property right
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf

Rest WebAPI with OData

  • 2. WHAT IS WEB API? • API(Application Programming Interface) is a interface between two software which allows interaction between each other. • It is a messenger, which receives the request for services, send it to the server and finally respond it to the client. • E.g. Consider a restaurant where customer(Client), who orders the food to the waiter(API), and kitchen room(Server) receives the order and delivers the food.
  • 5. • We need a service for any device with front end o Easy o Simple o Lightweight o All features of HTTP • ReST-ful(Representational State Transfer) Services fulfill all the above needs. Need of API’s
  • 6. INTRODUCTION TO REST • It is an architectural pattern for developing web services as opposed to a specification. • REST architectures are realized by applying specific interaction constraints such as performance, reliability, scalability, simplicity, modifiability, visibility and portability. • Web service API’s that adheres to REST architectural constraints are RESTful Web API’s
  • 7. INTRODUCTION TO REST • REST web services communicate over the HTTP specification, using HTTP vocabulary: o Methods (GET, POST, etc.) o HTTP URI syntax (paths, parameters, etc.) o Media types (xml, json, html, plain text, etc) o HTTP Response codes.
  • 8. INTRODUCTION TO REST • Representational o Clients possess the information necessary to identify, modify, and/or delete a web resource. • State o All resource state information is stored on the client. • Transfer o Client state is passed from the client to the service through HTTP.
  • 9. INTRODUCTION TO REST The six characteristics of REST: 1. Uniform interface 2. Decoupled client-server interaction 3. Stateless 4. Cacheable 5. Layered 6. Extensible through code on demand (optional) *Services that do not conform to the above required constraints are not strictly RESTful web services.
  • 10. HTTP-REST REQUEST BASICS • The HTTP request is sent from the client. o Identifies the location of a resource. o Specifies the verb, or HTTP method to use when accessing the resource. o Supplies optional request headers (name-value pairs) that provide additional information the server may need when processing the request. o Supplies an optional request body that identifies additional data to be uploaded to the server (e.g. form parameters, attachments, etc.)
  • 11. HTTP-REST REQUEST BASICS • A typical client GET request: • A typical client POST request: POST /save HTTP/1.1 User-Agent: IE Content-Type: application/x-www-form-urlencoded [CRLF] name=x&id=2 Requested Resource (path and query string) Request Headers (no request body) Requested Resource (typically no query string) Request Headers Request Body (e.g. form parameters)
  • 12. HTTP-REST RESPONSE BASICS • The HTTP response is sent from the server. o Gives the status of the processed request. o Supplies response headers (name-value pairs) that provide additional information about the response. o Supplies an optional response body that identifies additional data to be downloaded to the client (html, xml, binary data, etc.)
  • 13. HTTP-REST RESPONSE BASICS • Sample Server Responses: HTTP/1.1 500 Internal Server Error HTTP/1.1 201 Created Location: /view/7 [CRLF] Some message goes here. Response StatusHTTP/1.1 200 OK Content-Type: text/html Content-Length: 1337 [CRLF] <html> <!-- Some HTML Content. --> </html> Response Headers Response Body (content) Response Status Response Status Response Header Response Body Response Status
  • 14. HTTP-REST VOCABULARY HTTP Methods supported by REST: • GET – Requests a resource at the request URL o Should not contain a request body, as it will be discarded. o May be cached locally or on the server. o May produce a resource, but should not modify on it. • POST – Submits information to the service for processing o Should typically return the new or modified resource. • PUT – Add a new resource at the request URL • DELETE – Removes the resource at the request URL • OPTIONS – Indicates which methods are supported • HEAD – Returns meta information about the request URL
  • 15. HTTP-REST VOCABULARY A typical HTTP REST URL: • The protocol identifies the transport scheme that will be used to process and respond to the request. • The host name identifies the server address of the resource. • The path and query string can be used to identify and customize the accessed resource. http://my.store.com/fruits/list?category=fruit&limit=20 protocol host name path to a resource query string
  • 16. HTTP AND REST A REST service framework provides a controller for routing HTTP requests to a request handler according to: • The HTTP method used (e.g. GET, POST) • Supplied path information (e.g /service/listItems) • Query, form, and path parameters • Headers, cookies, etc.
  • 17. ROUTING IN WEB API Characteristics of routing in Web API: • We can use API controller names and a naming convention for actions to route Web API requests • Alternatively we can use the following attributes to control the mapping of HTTP requests (HTTP Verb+URL) to actions in the controller: • The HttpGet, HttpPut, HttpPost, or HttpDelete attributes • The AcceptVerbs attribute • The ActionName attribute
  • 18. CREATING A WEB API FOR AN MVC 4 WEB APPLICATION To create a Web API for a an MVC4 application: 1. Implement a Web API template in your project: o In the New Project dialog box, click ASP.NET MVC 4 Web Application o In the Select a Template box of the New ASP.NET MVC 4 Project dialog box, click Web API 2. Add an MVC API controller class to the project: o Hosts application code for handling requests o Derives from the ApiController base class 3. Add action methods to the controller class
  • 19. USING ROUTES AND CONTROLLERS IN WEB API’S Routing in ASP.NET MVC4 applications involves the following: • ASP.NET adds a default route to: o Map a URL and a controller o Support the operations of the REST-style Web APIs • We can modify the default route to include multiple actions in the same HTTP method • We can use the WebApiConfig class to: o Modify the routing o Enable multiple versions of API to coexist in the same project
  • 21. SECURITY Basically we require two techniques to make our WebApi more secure: o Authentication o Authorization o Maintaining Session
  • 22. SECURITY Basic Authentication o Basic authentication is a mechanism, where an end user gets authenticated through our service i.e. RESTful service with the help of plain credentials such as user name and password. o An end user makes a request to the service for authentication with user name and password embedded in request header. o Service receives the request and checks if the credentials are valid or not, and returns the response accordingly, in case of invalid credentials, service responds with 401 error code i.e. unauthorized.
  • 24. SECURITY Token Based Authorization o Authorization part comes just after authentication, once authenticated a service can send a token to an end user through which user can access other resources. o The token could be any encrypted key, which only server/service understands and when it fetches the token from the request made by end user, it validates the token and authorizes user into the system o Token can have its own lifetime, and may expire accordingly
  • 26. MAINTAINING SESSION • We can maintain sessions using Token based Authorization. • An authenticated user will be allowed to access resources for a particular period of time, and can re-instantiate the request with an increased session time delta to access other resource or the same resource. • We may need to implement login/logout for a user, to maintain sessions for the user, to provide roles and permissions to their user, all these features could be achieved using basic authentication and token based authorization.
  • 27. CACHING • HTTP caches can store copies of responses • Useful for reducing: o Network traffic o Server workload o Call latency • Caches are a main factor for scalability on the web
  • 28. CACHE-HEADERS • Cache-Control o no-cache (Default): Response may be cached, but revalidated on next request o no-store: Do not store a local copy o max-age: Set TTL, in seconds o private: Do not store in proxies • Expires o Default value: -1 (expired) o Specify date of expiration (UTC, up to a year from today) o max-age takes precedence • While a resource is cached and hasn’t expired, no request is sent to the server
  • 29. CACHING • ETag (entity tag) contains a resource’s version • Can be a hash, timestamp, version number, GUID, … • First time: Client sends a request Server adds ETag header to response Client caches response with ETag
  • 30. CACHING • ETag (entity tag) contains a resource’s version • Can be a hash, timestamp, version number, GUID, … • Subsequent calls: Client sends a request with ETag Server compares ETag to resource’s version Respond with HTTP 304 (Unmodified) Respond with the updated resource and Etag Client caches response with ETag
  • 31. REST SERVICES OVER SOAP REST is easier to use for the most part and is more flexible. It has the following advantages when compared to SOAP: o No expensive tools require to interact with the Web service o REST is lightweight as compare to SOAP o Smaller learning curve o Efficient (SOAP uses XML for all messages, REST can use smaller message formats) o Fast (no extensive processing required) o Closer to other Web technologies in design philosophy
  • 32. ODATA • Open Data protocol(OData) is an open protocol for sharing data. • It is built upon AtomPub, itself an extension of Atom Publishing Protocol. • Odata is based on REST; therefore a simple web browser can view the data exposed through an Odata service. • It not only allows read access but also whole set of CRUD operations.
  • 33. HOW ODATA WORKS • OData has four main parts: 1. OData data model 2. OData protocol 3. OData client libraries 4. OData service
  • 34. REQUESTING RESOURCES • As an example we use the service of an open trip management system. • If a person named Russell White, who has formerly registered at Tripin, would like to find out who are the other people in it.
  • 37. REQUESTING RESOURCES • By Individual resource url: serviceRoot/People(‘Mahek’) • By Individual property url: serviceRoot/Airports(‘IGI’)/Name • By Individual property Raw Value url: serviceRoot/Airports(‘IGI’)/Name/$value
  • 38. QUERYING DATA • OData supports various kinds of query options for querying data. • Example:
  • 39. DATA MODIFICATION • Creating a resource Request Response
  • 40. DATA MODIFICATION • Deleting a resource Request : DELETE serviceRoot/People(‘Mahek’) Response: HTTP/1.1 204 No Content
  • 41. DATA MODIFICATION • Updating a resource Request Response
  • 42. DATA MODIFICATION • Relationships from one entity to another are represented as navigation properties. • Example: Here two persons are related by friendship.
  • 43. DATA MODIFICATION Invoking Function • OData supports defining functions to represent complicated logic which can be frequently used. • Example After having explored the TripPin OData service, Russell finds out that it has a function called GetInvolvedPeople from which he can find out the involved people of specific trip.
  • 44. ADVANCED FEATURES • Singleton • Derived Entity Type • Batch