Azure functions: how to bind query string parameters of http trigger function to SQL query of Cosmos DB -


i trying run http trigger azure function cosmos db input binding. url of http trigger include several parameters on query string become bound sql query of input cosmos db binding. trying following bindings in function.json, not work (the function not triggered):

{   "direction": "in",   "type": "httptrigger",   "authlevel": "anonymous",   "name": "req",   "methods": [ "get" ],   "route": "users/{age=age?}/{gender=gender?}" }, {   "direction": "in",   "type": "documentdb",   "name": "users",   "databasename": "database",   "collectionname": "users",   "sqlquery": "select * x x.age = {age} , x.gender = {gender}",   "connection": "cosmosdb_connection_string" }, 

according answer route constraint users/{age=age?}/{gender=gender?} valid web api, , according documentation you can use web api route constraint parameters. make request azure function looks api/users?age=30&gender=male. how should done then?

i don't think can configure cosmos db binding values defined in query parameters e.g. ?age=30. @ least haven't seen examples in functions documentation.

but can bind them route parameters achieve same outcome, have pretty done already.

keeping route of users/{age}/{gender}, cosmos sqlquery pick route parameters when invoking on http://yourfunctionhost/yourfunction/users/30/male


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -