{"info":{"_postman_id":"5dde8f60-f8dc-46b4-b512-5d22e85c0ea5","name":"Postman OData Tutorial","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item":[{"name":"01. Read the service root","id":"dbb0ea81-d146-4ad2-b68c-46f6cf96df6a","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/","description":"All REST APIs should have a single entry point from which a generic hypermedia client can navigate to the resources in the service. In the response we see links to three things: 1. The $metadata document that describes the schema of ther service 2. Links to various collections of objects like People and Airports 3. Links to other top-level items like Me (a singleton) and operations."},"response":[]},{"name":"02. Read the service metadata","id":"cee058c7-2bb4-442b-8e6b-9a8b67216235","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/$metadata","description":"$metadata is an endpoint in OData services that contains a machine-readable description of the service model including type schemas, available operations, etc."},"response":[]},{"name":"03. Read an entity set","id":"a7b78a2d-4f41-40c4-8e35-336ee12d1ff2","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People","description":"One of the most common responses from a REST API is a collection of resources. In this case we asked for the People collection. For each response, the OData service writes a self-described response (another REST principle) by annotating the response with a context URL. This context URL tells the service that the contents of the response are a collection of things in the People entity set. The @odata.nextLink annotation is present because the server opted to split the result set across multiple pages. The client can also drive paging using $top and $skip, but server-side paging is a mitigation against DoS attacks. The value property contains the bulk of the response. Note that @odata.id and @odata.editLink should generally not be present in the payload unless they deviate from convention. In this case it appears that there is a bug in our sample service. Pretend those properties aren't there."},"response":[]},{"name":"04. Get a single entity from an entity set","id":"9065567e-f3f8-4efd-a632-f25df4516131","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')","description":"To get a particular entity from a collection, append a key segment. By default, key segments in OData services are bounded by parens because they may be composite keys, e.g., OrderLine(OrderId=1,LineNumber=1) or alternate keys, e.g., Person(SSN='000-00-0000') and Person(2115) both address the same resource. Some OData services use normal URL segments for key segments, e.g., Orders/1. This is not recommended because of the scenarios mentioned above."},"response":[]},{"name":"05. Get a primitive property","id":"e5171e96-97a3-43fb-b984-e928cc06d10a","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')/FirstName","description":"Even when fetching a primitive property, an object wrapper is returned rather than returning the raw primitive. This is to protect against a JSON vulnerability."},"response":[]},{"name":"06. Get the raw value of a primitive property","id":"5b8207f0-eab6-4fba-afe5-4d0167944060","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')/FirstName/$value","description":"If you really want the raw value of a primitive property, you can get it by appending $value to the URL. Note that the Content-Type header indicates that the content is text/plain."},"response":[]},{"name":"07. Navigate to related entities","id":"5bf5cff5-1292-4be5-8233-b282f5c90cdc","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')/Friends('scottketchum')/AddressInfo","description":"To navigate the resource graph, keep appending segments representing valid property names as defined in $metadata or in a full metadata response (see query x). In this case we have started from the service root, navigated to the entity set People, navigated to the resource keyed 'russellwhyte', navigated to the Friends property, navigated to the resource keyed 'scottketchum', and finally navigated to the AddressInfo property. Note that the @odata.context URL self-describes the payload."},"response":[]},{"name":"08. Filter a collection","id":"3cf0ea1c-5531-4584-860a-c47bd5860713","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$filter=FirstName eq 'Vincent'","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$filter","value":"FirstName eq 'Vincent'"}]},"description":"The $filter system query option can be used to filter any collection of resources. Note that the response to a filtered collection is a collection of the same type, regardless of the number of matched resources."},"response":[]},{"name":"09. Filter on enumeration properties","id":"fc50474b-589d-4349-80a4-d9806f3aacd9","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$filter=Gender eq Microsoft.OData.SampleService.Models.TripPin.PersonGender'Female'","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$filter","value":"Gender eq Microsoft.OData.SampleService.Models.TripPin.PersonGender'Female'"}]},"description":"You can filter any type of collection in OData services. When referring to a member of enum properties, please don't ignore the namespace for the enum property."},"response":[]},{"name":"10. Filter on nested structures","id":"8bbb0eea-c0e8-4161-a0f6-66537083814e","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/Airports?$filter=Location/City/Region eq 'California'","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","Airports"],"query":[{"key":"$filter","value":"Location/City/Region eq 'California'"}]},"description":"You can use any related properties in a filter clause by using the same segments used in the path to traverse properties."},"response":[]},{"name":"11. Filter using logic operators","id":"5c56168d-913c-4fe2-b771-2c1befddf25a","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$filter=not(contains(FirstName,'Q')) and (AddressInfo/any(ai:ai/City/Region eq 'WA') or AddressInfo/any(ai:ai/City/Region eq 'ID'))","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$filter","value":"not(contains(FirstName,'Q')) and (AddressInfo/any(ai:ai/City/Region eq 'WA') or AddressInfo/any(ai:ai/City/Region eq 'ID'))"}]},"description":"You can use and, or and not to create more complex filter clauses."},"response":[]},{"name":"12. Filter using any/all operators","id":"7d468213-b469-44b1-8ad9-aa5ac04f479b","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$filter=Emails/any(e: endswith(e, 'contoso.com'))","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$filter","value":"Emails/any(e: endswith(e, 'contoso.com'))"}]},"description":"You can use any/all lambda-style filters for collection properties."},"response":[]},{"name":"13. Filter using built-in functions","id":"391b44cd-b88d-40a2-9b9e-e4723f49b7e5","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')/Trips(0)/PlanItems/Microsoft.OData.SampleService.Models.TripPin.Flight","description":"Built-in functions may be leveraged to filter the collection."},"response":[]},{"name":"14. Sort a collection","id":"46d1ecc3-02ea-45b9-9d09-74ee19c30e54","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$orderby=length(FirstName) desc,UserName","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$orderby","value":"length(FirstName) desc,UserName"}]},"description":"You can use the $orderby system query option to specify ordering criteria. You can use many of the functions usable in $filter in $orderby as well."},"response":[]},{"name":"15. Client-side paging","id":"de6de0bb-49c8-4036-ba23-9d586ca3f167","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$top=2&$skip=2","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$top","value":"2"},{"key":"$skip","value":"2"}]},"description":"There are two types of paging in OData services. Servers can enable server-side paging, returning nextLinks that clients can follow to subsequent pages. Clients can drive paging using $top and $skip."},"response":[]},{"name":"16. Counting the elements in a collection","id":"03f2d62f-c00e-44e7-a28b-10975e298023","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People/$count","description":"If you want to know how many items meet a condition, you can use the $count path segment. Note that the Content-Type header indicates that the content is text/plain. Although it doesn't work with system query options in the reference service, $count can typically be combined with $filter."},"response":[]},{"name":"17. Expand related entities","id":"73a780a8-9968-41e7-ba41-99cbd9e8ddc1","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$expand=Friends,Trips","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$expand","value":"Friends,Trips"}]},"description":"You can use the $expand system query option to include related resources. The expand clause can include many of the other system query options, enabling left-join type semantics. Also, you can expand <property>/$ref in order to get just the links to the related resources."},"response":[]},{"name":"18. Select the properties","id":"fdbe85ca-30ff-4d16-b050-bf41b702c914","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$select=FirstName,LastName","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$select","value":"FirstName,LastName"}]},"description":"You can use the $select system query option to only return specified properties."},"response":[]},{"name":"19. Request full metadata","id":"1f6d5831-e919-4b1f-9aec-c9262c029139","request":{"method":"GET","header":[],"url":{"raw":"http://services.odata.org/V4/TripPinService/People?$format=application/json;odata.metadata=full","protocol":"http","host":["services","odata","org"],"path":["V4","TripPinService","People"],"query":[{"key":"$format","value":"application/json;odata.metadata=full"}]},"description":"By default OData services return an extremely compact JSON format. This happens by stripping out all of the metadata that should be calculable by \"smart\" OData clients. For generic hypermedia clients, you can request additional metadata by using the Accept header or $format system query option to request application/json;odata.metadata=full. In this case, we get a bunch of additional annotations in the payload indicating type information and relationships to related resources."},"response":[]},{"name":"20. Casting types","id":"11622481-401d-4510-8d80-462789311184","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')/Trips(0)/PlanItems/Microsoft.OData.SampleService.Models.TripPin.Flight","description":"Another way of filtering items is to use a type cast segment. In this case we are looking for all of the flights that are part of Russell's trip. A type cast also allows us to append additional path segments that are properties of the subtype."},"response":[]},{"name":"21. Create an entity","id":"747f51e5-3ac9-4578-952f-e0539da15a9f","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"UserName\": \"miathompson\",\n  \"FirstName\": \"Mia\",\n  \"LastName\": \"Thompson\",\n  \"Gender\": \"Female\"\n}"},"url":"http://services.odata.org/V4/TripPinService/People","description":"To create a resource, send a POST to a collection."},"response":[]},{"name":"22. Delete an entity","id":"b1ac2934-c0da-4deb-ae54-a969c48db0d2","request":{"method":"DELETE","header":[{"key":"If-Match","value":"W/\"08D2931BACB7D7FD\""}],"body":{"mode":"formdata","formdata":[]},"url":"http://services.odata.org/V4/TripPinService/People('miathompson')","description":"To remove a resource, send an HTTP DELETE to the resource URL. Note: since the People entity set has concurrency enabled, you will need to request the resource and set the If-Match header to the appropriate value to run this request."},"response":[]},{"name":"23. Update an entity","id":"e820f895-8ab6-45d1-a806-da3119dd2b04","request":{"method":"PATCH","header":[{"key":"If-Match","value":"W/\"08D2931BACB7D7FD\""},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"Emails\": [\"miathompson@contoso.com\", \"miathompson@example.com\"]\n}"},"url":"http://services.odata.org/V4/TripPinService/People('miathompson')","description":"To update a resource, send a PATCH request with the properties you wish to modify. You can also use PUT, but the semantics for put require all properties to be either sent on the wire or reverted to their default values. Note: since the People entity set has concurrency enabled, you will need to request the resource and set the If-Match header to the appropriate value to run this request."},"response":[]},{"name":"24. Invoke an unbound function","id":"9a7d1ebc-9388-4d4d-907b-db275de4c968","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/GetNearestAirport(lat = 33, lon = -118)","description":"OData support unbound custom functions. The unbound functions can be invoked either with parameters or not and unbound functions can be viewed in the $metadata. Note: OData functions CANNOT have side effect, so only GET verb is allowed."},"response":[]},{"name":"25. Invoke a bound function","id":"ee99c67c-1d06-4a9b-8112-331bf00d715a","request":{"method":"GET","header":[],"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')/Microsoft.OData.SampleService.Models.TripPin.GetFavoriteAirline()","description":"OData support bound custom functions. The bound functions are bounded to a resource. Note: OData functions CANNOT have side effect, so only GET verb is allowed."},"response":[]},{"name":"26. Invoke a bound action","id":"6f2ded63-e76d-467b-a6d9-2548ae254d0d","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n\"userName\": \"scottketchum\",\n\"tripId\": 0\n}"},"url":"http://services.odata.org/V4/TripPinService/People('russellwhyte')/Microsoft.OData.SampleService.Models.TripPin.ShareTrip","description":"OData support bound custom actions. Actions can have side effects. So the HTTP verb for an OData action can be GET,POST,PUT,DELETE according to the behavior of the action. In the example below, the action implies a POST."},"response":[]}]}