ODATA Reads with Parameters
Data Reads with Parameters
In this post, we’ll focus on how to read an OData service with a parameter.
Read service method with a parameter
[EnableQuery]
public IQueryable<Student> Get(int marks)
{
return students.Where(s => s.Marks > marks).AsQueryable();
}
Now, we’ll see how to retrieve data with a parameter,
Url in the browser
In the browser, we can see only filtered students. in the URL, append the parameter with values.
Power Query Window
From the Power Query window, we can see the data set like this.
Download
TechNet Gallery
- Feel free to check the demo solution,https://gallery.technet.microsoft.com/ODATA-Read-service-using-6b74f799
GitHub
- You can find the GitHub repo from here, https://github.com/hansamaligamage/ODATAExample