Help with best practice - Implementing OData URL Conventions (V4) with Azure Functions V2

%3CLINGO-SUB%20id%3D%22lingo-sub-441298%22%20slang%3D%22en-US%22%3EHelp%20with%20best%20practice%20-%20Implementing%20OData%20URL%20Conventions%20(V4)%20with%20Azure%20Functions%20V2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-441298%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22ember-view%22%3E%3CSPAN%3EI%E2%80%99m%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F319716%22%20target%3D%22_blank%22%3E%40JohnKarwoski%3C%2FA%3E%26nbsp%3B%20looking%20for%20some%20best%20practices%20on%20implementing%20OData%20URL%20Conventions%20(V4)%20with%20Azure%20Functions%20V2%20(using%20.NET%20Core%202.1)%20that%20utilize%20a%20CosmosDb%20backend%20setup%20using%20the%20SQL%20API.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22ember-view%22%3E%3CSPAN%3EIf%20you%20have%20experience%20in%20this%20area%20please%20continue%20reading%20below%20and%20please%20reach%20out%20if%20this%20resonates.%20Just%205%20minutes%20of%20your%20time%20would%20be%20TRULY%20appreciated!%20Please%20forward%20this%20on%20to%20SMEs%20that%20might%20have%20insights.%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22ember-view%22%3E%3CSPAN%3EFor%20example%2C%20an%20Azure%20function%20that%20returns%20user%20tasks%20from%20the%20backend.%20What%20are%20the%20best%20practices%20to%20support%20OData%20%E2%80%98%24filter%E2%80%99%20and%20%E2%80%98%24select%E2%80%99%20query%20options%20from%20the%20URL%2C%20and%20translate%20those%20query%20options%20to%20a%20CosmosDb%20SQL%20syntax.%20I%E2%80%99d%20rather%20not%20write%20a%20custom%20parser%20if%20there%20are%20existing%20libraries%20to%20take%20advantage%20of.%20Example%20API%20call%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fmyapi.myapp.com%2Fv1%2Ftasks%3F%24filter%3DName%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmyapi.myapp.com%2Fv1%2Ftasks%3F%24filter%3DName%3C%2FA%3E%20eq%20'SomeTaskName'%20and%20TaskDuration%20lt%208%24select%3DDescription%2CStartDate%2CEstEndDate%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-441298%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-796347%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20best%20practice%20-%20Implementing%20OData%20URL%20Conventions%20(V4)%20with%20Azure%20Functions%20V2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-796347%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F319716%22%20target%3D%22_blank%22%3E%40JohnKarwoski%3C%2FA%3E%26nbsp%3B%3CSPAN%3EI%20could%20share%20with%20you%20a%20workaround%20while%20official%20support%20is%20being%20developed%3A%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Faletc1%2Fexamples-odata-azure-functions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Faletc1%2Fexamples-odata-azure-functions%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EFull%20details%20in%3A%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.algohace.net%2Fposts%2Fodata-en-azure-functions-v2%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fwww.algohace.net%2Fposts%2Fodata-en-azure-functions-v2%3C%2FA%3E%3CSPAN%3E%26nbsp%3B(Spanish%20only)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20you%20want%20to%20track%20the%20official%20request%2C%20please%20go%20to%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Functions%2Fissues%2F1044%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FAzure%2FAzure-Functions%2Fissues%2F1044%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1621255%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20best%20practice%20-%20Implementing%20OData%20URL%20Conventions%20(V4)%20with%20Azure%20Functions%20V2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1621255%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F389572%22%20target%3D%22_blank%22%3E%40aletc1%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F319716%22%20target%3D%22_blank%22%3E%40JohnKarwoski%3C%2FA%3E%26nbsp%3B%20For%20a%20V3%20function%20in%20.net%20core%203.1%20check%20out%20this%20issue%20and%20the%20GitHub%20repo.%20%26nbsp%3BGives%20you%20OData%20in%20azure%20function%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Functions%2Fissues%2F1044%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FAzure%2FAzure-Functions%2Fissues%2F1044%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fsmokedlinq%2FMicrosoft.Azure.WebJobs.Extensions.OData%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fsmokedlinq%2FMicrosoft.Azure.WebJobs.Extensions.OData%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

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"

2 Replies
Highlighted

@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

Highlighted