C#.NET WEBAPI 接口设计-调用多个参数的接口
作者:C/S框架网  发布日期:2017-09-20 09:04:25
  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/S框架网(www.csframework.com) QQ:1980854898



调用


C# Code:

string url = "http://localhost:8899/api/fuyou/post-data";
string param = "apikey=99999999&data=asdf0&sign=有新的报价信息";

//string result = WebApiTools.Get(url, param, "text/html;charset=UTF-8");//OK
string result = WebApiTools.Get(url, param, "application/x-www-form-urlencoded;charset=UTF-8");

txtResponse.Text = result;

//来源:C/S框架网(www.csframework.com) QQ:1980854898


上一篇 下一篇