Hello Devz,

Do you know Open Movie Database (OMDB)? It’s like IMDB but providing an API to get information about any movie or TV show. OMDBAPI is free but limited to 1000 request per day.

First you must generate your API Key via this page http://www.omdbapi.com/apikey.aspx

You will receive your personal key via email. Don’t forget to activate it, and let’s go !

using System;
using System.IO;
using System.Net;
using System.Text;

namespace OmdbDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            string apiKey = "YOUR_API_KEY";
            string baseUri = $"http://www.omdbapi.com/?apikey={apiKey}";

            string name = "maniac";
            string type = "series";

            var sb = new StringBuilder(baseUri);
            sb.Append($"&s={name}");
            sb.Append($"&type={type}");

            var request = WebRequest.Create(sb.ToString());
            request.Timeout = 1000;
            request.Method = "GET";
            request.ContentType = "application/json";

            string result = string.Empty;

            try
            {
                using (var response = request.GetResponse())
                {
                    using (var stream = response.GetResponseStream())
                    {
                        using (var reader = new StreamReader(stream, Encoding.UTF8))
                        {
                            result = reader.ReadToEnd();
                        }
                    }
                }
            }
            catch (WebException e)
            {
                Console.WriteLine(e);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine(result);
            Console.WriteLine("Press any key...");
            Console.ReadKey();
        }
    }
}

Don’t forget to replace YOUR_API_KEY by… your own api key!  :p

The result of this call will return a JSON content. Now all you have to do to use it, is to deserialize it. You can find more information about how to serialize and deserialize JSON content in this post: https://code.4noobz.net/c-json-serialize-and-deserialize/

Happy coding!  🙂