How to get the metadata of the OData service:
https://services.odata.org/v4/northwind/northwind.svc/$metadata
http://localhost:8080/sap/opu/odata/sap/ZOData_Service/$metadata
How to get the no of records from the entity
https://services.odata.org/v4/northwind/northwind.svc/Customers/$count
http://localhost:8080/sap/opu/odata/sap/ZOData_Service/Customers/$count
Here the entity mentioned in the URL is ‘Customers’. Customers is not case sensitive
The above url will print out the no of records in the entity set Customers.
How to get all the data or entities for one Entityset
https://services.odata.org/v4/northwind/northwind.svc/Customers
http://localhost:8080/sap/opu/odata/sap/ZOData_Service/Customers
the above url will print out all the data contained in the entity ‘Customers’
How to get a single entity with the Primary key value
https://services.odata.org/v4/northwind/northwind.svc/Customers(‘ALFKI’)
http://localhost:8080/sap/opu/odata/sap/ZOData_Service/Customers(‘ALFKI’)
The primary key property for the Customers is ‘CustomerID’
The above url will print out the single record of Customer with the ID ‘ALFKI’
How to select specific columns from an Entity set
https://services.odata.org/v4/northwind/northwind.svc/Customers?$select=CustomerID,ContactName
http://localhost:8080/sap/opu/odata/sap/ZOData_Service/Customers?$select=CustomerID,ContactName
The above URL will print out the details of the customer with only CustomerID and contact name.