Building clients for OData services
Finally, let’s see how a .NET client might call the OData web service. Let’s review how clients interact with an OData service.
If we want to query the OData service for products that start with the letters Cha
, then we would need to send a GET
request with a relative URL path similar to the following:
catalog/products/?$filter=startswith(ProductName, 'Cha')&$select=ProductId,ProductName,UnitPrice
OData returns data in a JSON document with a property named value
that contains the resulting products as an array, as shown in the following JSON document:
{
"@odata.context": "https://localhost:5101/catalog/$metadata#Products",
"value": [
{
"ProductId": 1,
"ProductName": "Chai",
"SupplierId": 1,
"CategoryId": 1,
"QuantityPerUnit": "10 boxes x 20 bags",
"UnitPrice...