本代码示例是基于C#的六派数据接口进行数据请求 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/parking/ 申请API服务
以下是完整代码示例:
class Response
{
public string statusCode;
}
static void Main(string[] args)
{
string method = "POST";
string url = "http://open.liupai.net/parking/ParkInfoList";
Dictionary<string, string> param = new Dictionary<string, string>();
param.Add("appkey", "yourappsecret");
param.Add("cityName", "深圳市");//城市名,比如:深圳市
param.Add("currentPage", "1");//当前页
param.Add("pageSize", "50");//分页大小
Dictionary<string, string> headers = null;
string result = api_send_request(method, url, param, headers);
if (result == "")
{
//返回内容异常,发送请求失败
Console.WriteLine("发送请求失败");
return;
}
Response res = new JavaScriptSerializer().Deserialize<Response>(result);
if (res.statusCode == "200") //有个别接口计费状态码为其他;请注意甄别
{
//状态码为200, 说明请求成功
Console.WriteLine(string.Format("请求成功: {0}", result));
}
else
{
//状态码非200, 说明请求失败
Console.WriteLine(string.Format("请求失败: {0}", result));
}
Console.ReadLine();
}
本代码示例是基于C#的六派数据接口进行数据请求 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/parking/ 申请API服务
以下是完整代码示例:
class Response
{
public string statusCode;
}
static void Main(string[] args)
{
string method = "POST";
string url = "http://open.liupai.net/parking/NearbyParkInfoList";
Dictionary<string, string> param = new Dictionary<string, string>();
param.Add("appkey", "yourappsecret");
param.Add("longitude", "114.122044");//经度
param.Add("latitude", "22.538309");//纬度
param.Add("distance", "100");//距离,单位米
param.Add("pageSize", "50");//分页大小
param.Add("currentPage", "1");//当前页
Dictionary<string, string> headers = null;
string result = api_send_request(method, url, param, headers);
if (result == "")
{
//返回内容异常,发送请求失败
Console.WriteLine("发送请求失败");
return;
}
Response res = new JavaScriptSerializer().Deserialize<Response>(result);
if (res.statusCode == "200") //有个别接口计费状态码为其他;请注意甄别
{
//状态码为200, 说明请求成功
Console.WriteLine(string.Format("请求成功: {0}", result));
}
else
{
//状态码非200, 说明请求失败
本代码示例是基于C#的六派数据接口进行数据请求 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/parking/ 申请API服务
以下是完整代码示例:
class Response
{
public string statusCode;
}
static void Main(string[] args)
{
string method = "POST";
string url = "http://open.liupai.net/parking/queryParkInfoById";
Dictionary<string, string> param = new Dictionary<string, string>();
param.Add("appkey", "yourappsecret");
param.Add("parkUUId", "ff80808147ba04020147ca2b9e5e64d9");//停车场UUID,可选(parkId,parkUUId二选一)
param.Add("parkId", "148171");//停车场Id
Dictionary<string, string> headers = null;
string result = api_send_request(method, url, param, headers);
if (result == "")
{
//返回内容异常,发送请求失败
Console.WriteLine("发送请求失败");
return;
}
Response res = new JavaScriptSerializer().Deserialize<Response>(result);
if (res.statusCode == "200") //有个别接口计费状态码为其他;请注意甄别
{
//状态码为200, 说明请求成功
Console.WriteLine(string.Format("请求成功: {0}", result));
}
else
{
//状态码非200, 说明请求失败
Console.WriteLine(string.Format("请求失败: {0}", result));
}
Console.ReadLine();
}