Exploring OData
Overview
OData RESTful APIs are easy to consume. The OData metadata, a machine readable description of the data model of the APIs, enables the creation of powerful generic client proxies and tools. Some of them can help you interact with OData even without knowing anything about the protocol.
If you want to have a quick look at the protocol, here are some examples of how to use the OData protocol using simple http requests.
The following tools are good to explore the OData protocol:
- Postman
- curl
- REST Client for Visual Studio Code
- Any web browser
Note: The URLs below are not properly URL-encoded for readability purposes. This needs to be done manually or through a tool like Postman or similar.
Get all Branches
Get two Branches
Get a specific Branch
GET https://mydomain.com/odata/Branches?$filter=Branch eq 'Lone Tree' HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0
Get a Visit Transaction with waiting time over 10 minutes in a specific Branch
GET https://mydomain.com/odata/VisitTransactions?$filter=BranchKey eq 4 and WaitingTime gt 6000 HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0
Get Services ordered by name
GET https://mydomain.com/odata/Services?$orderby=Service asc HTTP/1.1
OData-Version: 4.0
OData-MaxVersion: 4.0