简体   繁体   English

防暴http api调用.NET MVC

[英]Riot http api call .NET MVC

        WebClient client = new WebClient();
        string json_response = client.DownloadString("https://tr.api.pvp.net/api/lol/tr/v1.4/summoner/by-name/SUMMONERNAME?api_key=KEY");
        dynamic deserialized_response = JsonConvert.DeserializeObject<dynamic>(json_response);
        string Summonerid = deserialized_response.id;

Hi there i am trying to call only id but im failing it. 嗨,我正在尝试仅调用id,但即时通讯失败。 i also tried to do this with viewmodel but still i have failed. 我也试图用viewmodel做到这一点,但仍然失败了。 And i also want to make a variable SUMMONERNAME how can i have a textbox input to SUMMONERNAME. 而且我还想创建一个变量SUMMONERNAME,如何将文本框输入到SUMMONERNAME。 this is the api's reference link " https://developer.riotgames.com/api/methods#!/1079/3722 " 这是api的参考链接“ https://developer.riotgames.com/api/methods#!/1079/3722

        string json_response = client.DownloadString("https://tr.api.pvp.net/api/lol/tr/v1.4/summoner/by-name/SUMMONERNAME?api_key=KEY");
        RiotApiViewModel deserialized_response = JsonConvert.DeserializeObject<RiotApiViewModel>(json_response);
        long id = deserialized_response.id;

var foundSummoner = JsonConvert.DeserializeObject>(json_response); var foundSummoner = JsonConvert.DeserializeObject>(json_response); this is fixed my error 这是固定的我的错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM