使用imdb-api,当我打电话时,我没有收到任何东西
我正在使用IMDB Web API(
以下是我称为的API:
private void SearchForMovie()
{
string hostURL = "https://imdb-api.com/eng/API/SearchMovie/" +apiKey+ "/" + Searchbar.Text;
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(hostURL);
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string jsonData = objReader.ReadToEnd();
searchData = JsonConvert.DeserializeObject<SearchData>(jsonData);
MessageBox.Show(searchResult.Id);
}
这是网站上的.json文件我应该使用:
using System.Collections.Generic;
public class SearchData
{
public string SearchType { get; set; }
public string Expression { get; set; }
public List<SearchResult> Results { get; set; }
public string ErrorMessage { get; set; }
}
public class SearchResult
{
public string Id { get; set; }
public string ResultType { get; set; }
public string Image { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
public enum SearchType
{
Title = 1,
Movie = 2,
Series = 4,
Name = 8,
Episode = 16,
Company = 32,
Keyword = 64,
All = 128
}
I am writing a program using the IMDB web api (https://imdb-api.com/) however when I am making a call with it I am not receiving any data back, I have reached out to them a few weeks ago but still not heard any response. The apiKey is correct and part of another function.
Below is the api I call I am making:
private void SearchForMovie()
{
string hostURL = "https://imdb-api.com/eng/API/SearchMovie/" +apiKey+ "/" + Searchbar.Text;
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(hostURL);
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string jsonData = objReader.ReadToEnd();
searchData = JsonConvert.DeserializeObject<SearchData>(jsonData);
MessageBox.Show(searchResult.Id);
}
And this is the .Json file that on there website said I should use:
using System.Collections.Generic;
public class SearchData
{
public string SearchType { get; set; }
public string Expression { get; set; }
public List<SearchResult> Results { get; set; }
public string ErrorMessage { get; set; }
}
public class SearchResult
{
public string Id { get; set; }
public string ResultType { get; set; }
public string Image { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
public enum SearchType
{
Title = 1,
Movie = 2,
Series = 4,
Name = 8,
Episode = 16,
Company = 32,
Keyword = 64,
All = 128
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论