Reputation: 11
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
}
Upvotes: 1
Views: 614