C#.NET WEBAPI 接口设计-调用多个参数的接口
C#.NET WEBAPI 接口设计-调用多个参数的接口WEBAPI接口方法,必须使用HttpGet以及ActionName特性!
C# Code:
[HttpGet]
[ActionName("post-data")]
public HttpResponseMessage PostData(string apikey, string data, string sign)
{
return new HttpResponseMessage();
}
调用
C# Code:string url = "
http://localhost:8899/api/fuyou/post-data";
string param = "apikey=99999999&data=asdf0&sign=有新的报价信息";
string result = WebApiTools.Get(url, param, "application/x-www-form-urlencoded;charset=UTF-8");
txtResponse.Text = result;