Sie sind auf Seite 1von 1

08/11/2016

BasicTutorialODatatheBestWaytoREST

Basic Tutorial
The Open Data Protocol (OData) is a data access protocol built on core protocols like HTTP and commonly accepted methodologies like
REST for the web. There are various kinds of libraries (http://www.odata.org/libraries/) and tools (http://www.odata.org/ecosystem/)
can be used to consume OData services. But for beginners and those who want to write their own libraries, the pure HTTP requests
and responses are also very important. This documentation will not cover every feature details for OData V4 services but will try to
cover various typical scenarios. If you want to have a more detailed understanding, please refer to OData Documentation
(http://www.odata.org/documentation/odata-version-4-0/).
You can now use the Postman collections (http://www.odata.org/getting-started/learning-odata-on-postman) to learn OData in an
interactive way.

Please be noted
This is the Basic section. For topics like Singleton, Inheritance, Open Type, Containment and Batch, please refer to Advanced
Section (http://www.odata.org/getting-started/advanced-tutorial/).
All these are based on OData V4 sample serviceTripPin (http://services.odata.org/V4/TripPinServiceRW), please just replace the
serviceRoot below with the URL http://services.odata.org/V4/TripPinServiceRW . TripPin now supports ETag, so for data
modication topics, you should rst using GET on TripPin (eg. GET serviceRoot/People) to get the section information in the
payload then use the URL with section for data modication examples. (something looks like
http://services.odata.org/V4/(S(at4rgegiueineatspfdku1))/TripPinServiceRW)
You may use Fiddler (http://www.telerik.com/ddler) to run the request (especially the complex ones of data modication) and
get the JSON response.
In TripPin service, ETag is currently enabled on entity Person. We omit the ETag related headers in request headers for short,
please go to the ETag Section (http://www.odata.org/getting-started/basic-tutorial/#etag) for detailed information.
We will keep improving this by adding contents and xing bugs. You can provide your feedbacks and ask questions using OData
Mailling List (http://www.odata.org/join-the-odata-discussion/).

Requesting Data
OData services support requests for data via HTTP GET requests.

Requesting Entity Collections


The request below returns the the collection of Person People.
GETserviceRoot/People

Response Payload

http://www.odata.org/gettingstarted/basictutorial/

1/19

Das könnte Ihnen auch gefallen