后台调⽤API接⼝
string dd = model.Fatherid;
string serviceAddress = "st/api/PropertyData/GetFloorBuilding";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serviceAddress);
request.Method = "POST";
request.ContentType = "application/json";
string strContent = @"{ ""Fatherid"": " + "'" + dd + "'" + "}";//参数
using (StreamWriter dataStream = new StreamWriter(request.GetRequestStream()))
{
dataStream.Write(strContent);//写⼊参数
dataStream.Close();
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string encoding = response.ContentEncoding;
if (encoding == null || encoding.Length < 1)
{
encoding = "UTF-8"; //默认编码
}
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding)); string retString = reader.ReadToEnd();
//JObject jo = JObject.Parse(retString);
//解析josn
GetFloorBuildingResult jo1 = JsonConvert.DeserializeObject<GetFloorBuildingResult>(retString);
百度api接口return jo1;
//GetFloorBuildingResult 返回结果
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论