3. Open Data Protocol (OData)
What is OData?
•OData is anWeb Standard and Protocol that defines the
best practice for building and consuming RESTfulAPIs.
•OData helps you focus on your business logic while
building RESTfulAPIs without having to worry about the
approaches to define your APIs.
•OData RESTfulAPIs are easy to consume.
5. Some Basics about HTTP
Resources
These are the URLs you use to get to pages on the
web
Request Headers
These are additional instructions that are sent
with the request.These might define what type of
response is required or authorization details.
RequestVerbs
These describe what you want to do with the
resource. A browser typically issues a GET verb to
instruct the endpoint it wants to get data,
however there are many other verbs available
including things like POST, PUT and DELETE.
Request Body
Data that is sent with the request. For example a
POST (creation of a new item) will required
some data which is typically sent as the request
body in the format of JSON or XML.
Response Body
This is the main body of the response. If the
request was to a web server, this might be a full
HTML page.
Response Status codes
These codes are issues with the response and
give the client details on the status of the
request.
6. Some Basics about HTTP -Verbs
GET
Requests a representation of the specified resource.
Requests using GET should only retrieve data and
should have no other effect.
POST
Requests that the server accept the entity enclosed in
the request as a new subordinate of the web resource
identified by the URI.
PUT
Requests that the enclosed entity be stored under the
supplied URI.
DELETE
Deletes the specified resource.
7. Some Basics about HTTP – Response Codes
1XX
Request received, continuing process.
This class of status code indicates a provisional
response, consisting only of the Status-Line and
optional headers, and is terminated by an empty line.
2XX
This class of status codes indicates the action
requested by the client was received, understood,
accepted and processed successfully.
3XX
This class of status code indicates the client must take
additional action to complete the request.
4XX
The 4xx class of status code is intended for cases in which the
client seems to have errored.
5XX
The server failed to fulfill an apparently valid request.
Response status codes beginning with the digit "5"
indicate cases in which the server is aware that it has
encountered an error or is otherwise incapable of
performing the request.
8. What is REST?
•REST stands for Representational State Transfer.
•An architectural style for building loosely coupled
systems
•REST is not a "standard".There will never be aW3C
recommendataion for REST
•It relies on a stateless, client-server, cacheable
communications protocol -- and in virtually all cases, the
HTTP protocol is used.
10. How does OData use REST?
•ODataAPIs are just Collections ofTyped Entities
(Resources)
•OData services expose all these Resources via URIs
•OData services use HTTP Verbs to intereact with
Resources
•OData services can also expose Actions and Function for
custom work
11. How OData use HTTPVerbs?
HTTP Command (Verb) SQL Command
GET SELECT
PUT UPDATE
POST INSERT
DELETE DELETE
12. OData in 6 Simple Steps
1. Requesting Resources
2. Requesting an Individual Resource
3. Queries
4. Creating a New Resource
5. Relating Resources
6. Invoking a Function