2.1 The OMDb API
In this lesson I will introduce you to an open-source API service called the “Open Movie Database”, showing you where you can find more information on how to use the service.
2.1 The OMDb API
Hello and welcome back. In this lesson, I want to introduce you to the OMDb API. OMDb stands for the Open Movie Database. And this is the API that we're gonna be using in this course as we play around with the view framework. This is a free API, where we can sign up for an API key and once we have our API key we can use that key, to search their database and display the search results on our own website. And we're gonna be using the view js framework to display those results. And you can get to this website at omdbapi.com. And on the homepage, if we scroll down a little bit, we can see some information on the usage. First of all, we can see that we need to send all of our data request to this url here, and once you get your API key, you simply replace this, with that API key and without those square brackets there. So you'll set API key equal to whatever your API key is. And then after the ampersand here this is where we would include our search keywords, and other parameters that we might wanna use in our search. And then below that is for the poster API which we're not gonna be talking about in this course. So again, we're just gonna be focusing on this url here, and then as we scroll down further, we can see all of the parameters that we can use. So there are two different types of search here. We can either pull down a movie by its IMDb ID, or by the title of the movie, and you'll notice in this parameter list, that we have two optional parameters here. And they are optional but one of the two is required, you're either gonna search by a valid IMDb ID, which is the Internet Movie Database. We would just add I equals and then that ID. To our query string. Or if we wanna just search, by title we would use t instead of i. And the second way we can search is by using this s parameter here. And notice there are other parameters here. These other parameters allow you customize, the results that are returned to you, and you can read through those to see those for yourself. But again we can also do a search by using the S parameter instead of the I or T parameter. So if we set S equal to a movie title, or a part of a movie title, then it will give us a number of search results, based on that query. And so what we're gonna do in this course, is we're going to search for movie title using this S perimeter, and it's gonna give us a number of results. And each of the of those results is going to have, an IMDb ID attached to it. So then if we click on one of those search results, we're gonna use that IMDb ID. To pull in more information about that particular movie, using this I parameter. And if it doesn't make sense yet, don't worry about it. The main focus of this course if View JS, which is why I chose a very simple API, and we will discover as we go through, that this is really, really simple to use. And the main thing you need to know here, is that if you're going to use this API, you're going to need an API key. Now, I've got my own API key that I'm gonna be using in this course, but you're gonna need to get your own API key in order for this to work. So at the top of the website, you'll see this link for the API Key, and here's where you will generate your API Key. You can either use the Patreon account type, which means you're going to be donating to OMDb. Or you can use the free version which is what we're gonna use here, which has a one thousand result daily limit. But if you fill out this information, hit submit, then you will get your API key, which you can then use along with the API Key, to start searching for movies. So, thank you for watching, and we'll get started in the next lesson.