How should I pass multiple parameters to an ASP.Net Web API GET?

前端 未结 11 1401
温柔的废话
温柔的废话 2020-12-12 09:59

I am using the .Net MVC4 Web API to (hopefully) implement a RESTful api. I need to pass in a few parameters to the system and have it perform some action, then return a lis

11条回答
  •  情歌与酒
    2020-12-12 10:50

    Now you can do this by simply using

            public string Get(int id, int abc)
            {
                return "value: " + id + "  " + abc;
            }
    

    this will return: "value: 5 10"

    if you call it with https://yourdomain/api/yourcontroller?id=5&abc=10

提交回复
热议问题