今天是放假最后一天
某些客户有OEM DTU配置工具的需要
根据合宙的接口做了这个
json解析和上传信息暂时还没做,后续会更新的.
登录
http://dtu.openluat.com/api/site/login?name=用户名&password=密码
登出
http://dtu.openluat.com/api/site/logout
用户信息
http://dtu.openluat.com/api/site/user
查询模块参数(如果不填就是查询所有模块参数
http://dtu.openluat.com/api/site/group?search_name=模块imei
下面是用c#+restsharp 写的几个重要函数
private void button1_Click(object sender, EventArgs e)
{
//登录并保存cookie
var client = new RestClient("http://dtu.openluat.com/api/site/login?name=" + textBox1.Text + "&password=" + textBox2.Text + "");
client.CookieContainer = new System.Net.CookieContainer();
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
foreach (var cookie in response.Cookies)
{
cookie_name= cookie.Name.ToString();
cookie_value=cookie.Value.ToString();
}
}
private void button2_Click(object sender, EventArgs e)
{
//查询模块信息
var client = new RestClient("http://dtu.openluat.com/api/site/group?search_name=" + textBox3.Text);
client.CookieContainer = new System.Net.CookieContainer();
var request = new RestRequest(Method.GET);
request.AddParameter(cookie_name, cookie_value, ParameterType.Cookie);
IRestResponse response = client.Execute(request);
textBox4.Text=response.Content;
}
private void button3_Click(object sender, EventArgs e)
{
//查询用户信息
var client = new RestClient("http://dtu.openluat.com/api/site/user");
client.CookieContainer = new System.Net.CookieContainer();
var request = new RestRequest(Method.GET);
request.AddParameter(cookie_name, cookie_value, ParameterType.Cookie);
IRestResponse response = client.Execute(request);
textBox4.Text = response.Content;
}
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!