0

why i am getting %7Buser_id%7D into my url, here is my function.json parameter file of Azure function.

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": ["get"],
      "route": "employee/{id:int?}"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ]
}

and this is my actual http azure function code

import logging

import azure.functions as func


def main(req: func.HttpRequest) -> func.HttpResponse:
    
    id = req.route_params.get('id')
    message = f"ID:{id}"
    return func.HttpResponse(message)

abhi
  • 41
  • 1
  • 7
  • Does this answer your question? [What do the chars %7D mean in an url query?](https://stackoverflow.com/questions/22510329/what-do-the-chars-7d-mean-in-an-url-query) – Aserre Dec 23 '21 at 09:46
  • thank you Aserre, but i am looking for workaround or solution , it seems they just explain about the issue – abhi Dec 23 '21 at 09:55
  • You are passing the litteral string `{user_id}` in your url. If your problem is about how to pass a parameter in the url to azure, you should edit the title of your question. – Aserre Dec 23 '21 at 09:57
  • Also, in your yaml/python script, `user_id` is never written. If you are talking about the parameter in `employee/{id:int?}`, use the same variable name everywhere so that readers can understand your question better – Aserre Dec 23 '21 at 09:59
  • @abhi, Any update to the issue? If yes, please post your workaround or solution! –  Jan 03 '22 at 07:27

0 Answers0