Forum Discussion
JohnKarwoski
Apr 11, 2019Copper Contributor
Help with best practice - Implementing OData URL Conventions (V4) with Azure Functions V2
I’m JohnKarwoski looking for some best practices on implementing OData URL Conventions (V4) with Azure Functions V2 (using .NET Core 2.1) that utilize a CosmosDb backend setup using the SQL API.
If you have experience in this area please continue reading below and please reach out if this resonates. Just 5 minutes of your time would be TRULY appreciated! Please forward this on to SMEs that might have insights.
For example, an Azure function that returns user tasks from the backend. What are the best practices to support OData ‘$filter’ and ‘$select’ query options from the URL, and translate those query options to a CosmosDb SQL syntax. I’d rather not write a custom parser if there are existing libraries to take advantage of. Example API call: "https://myapi.myapp.com/v1/tasks?$filter=Name eq 'SomeTaskName' and TaskDuration lt 8$select=Description,StartDate,EstEndDate"
- aletc1Copper Contributor
JohnKarwoski I could share with you a workaround while official support is being developed: https://github.com/aletc1/examples-odata-azure-functions
Full details in: https://www.algohace.net/posts/odata-en-azure-functions-v2 (Spanish only)
If you want to track the official request, please go to: https://github.com/Azure/Azure-Functions/issues/1044
- stevepearsonCopper Contributor
aletc1 JohnKarwoski For a V3 function in .net core 3.1 check out this issue and the GitHub repo. Gives you OData in azure function
https://github.com/Azure/Azure-Functions/issues/1044https://github.com/smokedlinq/Microsoft.Azure.WebJobs.Extensions.OData
- JohnSharp1975Copper Contributor
I've been trying to get OData and Azure functions to work for a few days now. I can confirm that it's a complete pig to setup but it is possible using only the Microsoft NuGet packages.