电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

eoLinker-API_Shop_万智卡卡牌查询_API接口_C#调用示例代码

9页
  • 卖家[上传人]:亿***
  • 文档编号:42471928
  • 上传时间:2018-06-02
  • 文档格式:DOCX
  • 文档大小:12.29KB
  • / 9 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 1、eoLinker-API Shop 万智卡卡牌万智卡卡牌查询查询 C#调调用示例代用示例代码码万智卡卡牌万智卡卡牌查询查询获取炉万智牌信息,可获取全部,也可根据关键字查询某卡牌。该产该产品品拥拥有以下有以下APIs: :1.关键字获取卡牌列表2.获取卡牌列表3.获取卡牌信息注意,注意,该该示例代示例代码仅码仅适用于适用于 网站下网站下API 使用使用该产该产品前,您需要通品前,您需要通过过 https:/ 申申请请API服服务务1.关关键键字字获获取卡牌列表取卡牌列表 using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Text; using System.Web.Script.Serialization;namespace apishop_sdk class Program/* 转发请求到目的主机* param method string 请求方法* param url string 请求地址* param params Dictionary

      2、请求参数* param headers Dictionary 请求头* return string*/static string apishop_send_request(string method, string url, Dictionary param, Dictionary headers)string result = string.Empty;trystring paramData = “;if (param != null foreach (var item in param)if (sbuilder.Length 0)sbuilder.Append(“sbuilder.Append(item.Key + “=“ + item.Value);paramData = sbuilder.ToString();method = method.ToUpper();if (method = “GET“)url = string.Format(“0?1“, url, paramData);HttpWebRequest wbRequest = (HttpWebRequest)WebRe

      3、quest.Create(url);if (method = “GET“)wbRequest.Method = “GET“;else if (method = “POST“)wbRequest.Method = “POST“;wbRequest.ContentType = “application/x-www-form- urlencoded“;wbRequest.ContentLength = Encoding.UTF8.GetByteCount(paramData);using (Stream requestStream = wbRequest.GetRequestStream()using (StreamWriter swrite = new StreamWriter(requestStream)swrite.Write(paramData);HttpWebResponse wbResponse = (HttpWebResponse)wbRequest.GetResponse();using (Stream responseStream = wbResponse.GetRespo

      4、nseStream()using (StreamReader sread = new StreamReader(responseStream)result = sread.ReadToEnd();catchreturn “;return result;class Responsepublic string statusCode;static void Main(string args)string method = “POST“;string url = “https:/ param = new Dictionary(); param.Add(“apiKey“, “your_api_key“); /需要从获取 param.Add(“keyword“, “); /关键字 param.Add(“page“, “); /当前页码(默认1) param.Add(“pageSize“, “); /当前页面卡牌数量(默认30) Dictionary headers = null;string result = apishop_send_request(method, url, param, hea

      5、ders);if (result = “)/返回内容异常,发送请求失败Console.WriteLine(“发送请求失败“);return;Response res = new JavaScriptSerializer().Deserialize(result);if (res.statusCode = “000000“)/状态码为000000, 说明请求成功Console.WriteLine(string.Format(“请求成功: 0“, result);else/状态码非000000, 说明请求失败Console.WriteLine(string.Format(“请求失败: 0“, result);Console.ReadLine(); 2.获获取卡牌列表取卡牌列表 using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Text; using System.Web.Script.Serialization;namespace apishop_s

      6、dk class Program/* 转发请求到目的主机* param method string 请求方法* param url string 请求地址* param params Dictionary 请求参数* param headers Dictionary 请求头* return string*/static string apishop_send_request(string method, string url, Dictionary param, Dictionary headers)string result = string.Empty;trystring paramData = “;if (param != null foreach (var item in param)if (sbuilder.Length 0)sbuilder.Append(“sbuilder.Append(item.Key + “=“ + item.Value);paramData = sbuilder.ToString();method = method.ToUpper();if (met

      7、hod = “GET“)url = string.Format(“0?1“, url, paramData);HttpWebRequest wbRequest = (HttpWebRequest)WebRequest.Create(url);if (method = “GET“)wbRequest.Method = “GET“;else if (method = “POST“)wbRequest.Method = “POST“;wbRequest.ContentType = “application/x-www-form- urlencoded“;wbRequest.ContentLength = Encoding.UTF8.GetByteCount(paramData);using (Stream requestStream = wbRequest.GetRequestStream()using (StreamWriter swrite = new StreamWriter(requestStream)swrite.Write(paramData);HttpWebResponse w

      8、bResponse = (HttpWebResponse)wbRequest.GetResponse();using (Stream responseStream = wbResponse.GetResponseStream()using (StreamReader sread = new StreamReader(responseStream)result = sread.ReadToEnd();catchreturn “;return result;class Responsepublic string statusCode;static void Main(string args)string method = “POST“;string url = “https:/ param = new Dictionary(); param.Add(“apiKey“, “your_api_key“); /需要从获取 param.Add(“page“, “); /当前页码(默认1) param.Add(“pageSize“, “); /当前页面卡牌数量(默认30) Dictionary he

      9、aders = null;string result = apishop_send_request(method, url, param, headers);if (result = “)/返回内容异常,发送请求失败Console.WriteLine(“发送请求失败“);return;Response res = new JavaScriptSerializer().Deserialize(result);if (res.statusCode = “000000“)/状态码为000000, 说明请求成功Console.WriteLine(string.Format(“请求成功: 0“, result);else/状态码非000000, 说明请求失败Console.WriteLine(string.Format(“请求失败: 0“, result);Console.ReadLine(); 3.获获取卡牌信息取卡牌信息 using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Text; us

      《eoLinker-API_Shop_万智卡卡牌查询_API接口_C#调用示例代码》由会员亿***分享,可在线阅读,更多相关《eoLinker-API_Shop_万智卡卡牌查询_API接口_C#调用示例代码》请在金锄头文库上搜索。

      点击阅读更多内容
    最新标签
    监控施工 信息化课堂中的合作学习结业作业七年级语文 发车时刻表 长途客运 入党志愿书填写模板精品 庆祝建党101周年多体裁诗歌朗诵素材汇编10篇唯一微庆祝 智能家居系统本科论文 心得感悟 雁楠中学 20230513224122 2022 公安主题党日 部编版四年级第三单元综合性学习课件 机关事务中心2022年全面依法治区工作总结及来年工作安排 入党积极分子自我推荐 世界水日ppt 关于构建更高水平的全民健身公共服务体系的意见 空气单元分析 哈里德课件 2022年乡村振兴驻村工作计划 空气教材分析 五年级下册科学教材分析 退役军人事务局季度工作总结 集装箱房合同 2021年财务报表 2022年继续教育公需课 2022年公需课 2022年日历每月一张 名词性从句在写作中的应用 局域网技术与局域网组建 施工网格 薪资体系 运维实施方案 硫酸安全技术 柔韧训练 既有居住建筑节能改造技术规程 建筑工地疫情防控 大型工程技术风险 磷酸二氢钾 2022年小学三年级语文下册教学总结例文 少儿美术-小花 2022年环保倡议书模板六篇 2022年监理辞职报告精选 2022年畅想未来记叙文精品 企业信息化建设与管理课程实验指导书范本 草房子读后感-第1篇 小数乘整数教学PPT课件人教版五年级数学上册 2022年教师个人工作计划范本-工作计划 国学小名士经典诵读电视大赛观后感诵读经典传承美德 医疗质量管理制度 2
    关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
    手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
    ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.