What is HTTP(Hyper Text Transfer Protocol)?
HTTP is the underlying protocol on which OData is based and also one of the most common language which is spoken on the Internet.
You can request for a document located somewhere on this planet by providing its address via the browser which sends HTTP requests to the web server. The Web server then sends back HTTP response that is parsed by the Web Browser for you to view the document on your machine.
HTTP is based on a Client-Server architecture style and it uses a stateless request/response protocol to communicate between the client and the web server.
Why stateless? Every single HTTP request that is received by the web server is forgotten after a response has been sent across. Web servers do not process an HTTP request by remembering the previous request.
It means the request has been received and the process is continuing.
It means the action was successfully received, understood, and accepted.
It means further action must be taken in order to complete the request.
4xx: Client Error
It means the request contains incorrect syntax or cannot be fulfilled.
5xx: Server Error
It means the server failed to fulfill an apparently valid request.
What is ODATA?
What is a protocol->It is a set of rules.
OData is a REST-based protocol released under the Microsoft Open Specification Promise (OSP) for querying and updating data and is built on standardized technologies such as HTTP, Atom/XML, and JSON. Microsoft originally developed and introduced OData. Now OData is managed by the Oasis organisation .
What Is REST?
A term that you frequently come across when talking about OData is Representational State Transfer (REST). OData requests use the REST model, which was introduced in 2000 by Roy Fielding in his PhD dissertation.
An architecture is called RESTful if it complies with six architectural constraints:
- Client server architecture
A uniform interface separates clients from servers, resulting in a separation of concern.
No context is stored on the server between requests. Any request from a client contains all required information to service the request.
Responses have to define themselves as cacheable or not cacheable to prevent clients from using stale or inappropriate data in response to additional, later requests.
- Layered system
A client can’t tell whether it’s connected directly to the end server or to a server along the way.
- Uniform interface
A uniform interface between clients and servers decouples the architecture.
- Code on demand
Servers can temporarily extend or customize the functionality of a client by transferring executable code. This constraint is actually optional.
Each REST command is a request of one of the following types, informing the server from the client to perform one of the following operations on the server:
Get a single entry or a collection of entries.
Create a new entry.
Update an existing entry.
Remove an entry.
Update single properties of an existing entry.
[penci_blockquote style=”style-3″ align=”none” author=””]Note
A common misconception is to think about REST as some kind of protocol,
such as HTTP or Simple Object Access Protocol (SOAP). This is incorrect—
REST is a development paradigm, not a protocol.[/penci_blockquote]
Benefits of REST(Representational State Transfer) Over SOAP
- REST allows a greater variety of data formats, whereas SOAP only allows XML.
- REST is naturally stateless,
- Coupled with JSON (which typically works better with data and offers faster parsing), REST is generally considered easier to work with.Thanks to JSON, REST offers better support for browser clients.
- REST provides superior performance, particularly through caching for information that’s not altered and not dynamic.
- It is the protocol used most often for major services such as Yahoo, Ebay, Amazon, and even Google.
REST is generally faster and uses less bandwidth.
Benefits of SOAP((Simple Object Access Protocol) Over REST
- SOAP has built-in stateful operations.
- If you need more robust security, SOAP’s support for WS-Security can come in handy. It offers some additional assurances for data privacy and integrity.
- Another advantage of SOAP is that it offers built-in retry logic to compensate for failed communications.