OTT or Over The Top providers that deliver movies and TV shows via the internet have become increasingly popular among people nowadays. The reason is that OTT providers like Netflix, YouTube, and HBO allow you to view content on different devices and switch multiple services offering you much flexibility. There is a considerable growth of content at OTTP providers every day. Therefore, searching and browsing content in various OTT streaming services can be a hectic task.
Luckily, there are many APIs in the market that help users search and view the content on various OTT streaming services. OTT Details API is one such robust API that provides various details about movies and TV shows.
What is the OTT Details API?
OTT Details API is an API that can retrieve streaming details of Movies and TV Shows. It supports 150+ Streaming platforms in the US and India, such as HBO, YouTube, Netflix, Prime Video, Hotstar, Hulu, etc. In addition to streaming information, it also provides essential details on any given movie title.
Moreover, the API has five subscription plans, including a free subscription. It supports various programming languages such as Python, PHP, Ruby, NodeJS, and Javascript. In this article, we will see how to use this API with multiple programming languages and SDK.
How does the OTT Details API work?
OTT Details API works using simple API logic. It sends the request is to a specific endpoint and obtains the necessary output as the response. When sending the request, it includes ‘x-RapidAPI-key’ and ‘x-RapidAPI-host’ as authentication parameters to validate its authenticity. The body of the API request contains the parameters required to process it. Once the API server has received the request, the back-end application will process the request. It will retrieve the required information from a database, formulate the response, and send it to the client in JSON format.
Target Audience for the OTT Details API
Application Developers
People often use searching applications to search and browse for their favorite movies and TV Shows. If you aim to build such an application or website that helps users see all the various streaming services, this API is what you need. Because OTT Details API has all the streaming data, you need to build powerful search and browse experiences for your users. Using its variety of API endpoints, you can build search and browse by title, genres, imdb id, streaming platform, and many more.
Learners
OTT Details API is easy to learn and integrate with a lot of programming languages. It has a free plan, and its Pro plan only costs $10. Therefore, anyone who learns about APIs or wants to keep an up-to-date private movie or TV show database can make use of this API at a low cost.
How to connect to the OTT Details Tutorial – Step by Step
Step 1 – Sign up and Get a RapidAPI Account.
You can use RapidAPI to search and connect to thousands of APIs using a single SDK, API key, and Dashboard. RapidAPI is the world’s largest API marketplace used by more than a million developers worldwide.
To create a RapidAPI account, go to rapidapi.com and click on the Sign Up icon. You can use your Google, Github, or Facebook account for Single Sign-on (SSO) or manually create an account.
Step 2 – Search the API Marketplace
Next, Navigate to the Marketplace and search for “OTT Details API.” Then, select the ‘OTT Details API” from the search results.
Step 3 – Test the API
After loading the API page, navigate to the ‘Endpoints’ section of the API page, which shows all the available endpoints. Then, select the endpoint you want to test and add the required values for the parameters. Each API endpoint has code snippets in multiple languages, and it automatically adds the API keys, host, and accept parameters.
Finally, click on the “Test Endpoint” Button to test the API. Upon successful testing of an API endpoint, you will get the response with a 200 status code. It will output an error code and message if there is an error in the request.
OTT Details API Endpoints
Currently, RapidAPI provides eight endpoints in OTT Details API.
/getPlatforms
From this endpoint, you can get information about all the OTT streaming platforms the API supports. Currently, the API supports only the USA and India regions. The only required parameter for this endpoint is the ‘region’ parameter. Enter the region as ‘US’ if you want to get providers in the USA or ‘IN’ for India. You will get a JSON object array as the output in which the ‘label’ attribute contains the name of the OTT provider. Apart from that, it contains the value and a shortened name for the OTTP provider.
/search
This endpoint allows you to search for movies or TV shows based on a specific title. For example, if you want to search for movies having the title ‘ inception’, enter the movie title in the ‘title’ parameter and optionally specify the number of pages you want to return. You will get an array of movie objects that have the title’ Inception.’ In addition, it contains details like genre, IMDB id, released year, image URL, and synopsis.
/getParams
Using this endpoint, you can get an array of values that you can use as parameters in the advanced search endpoint. Or else, you can get an array of genres or languages that you can use as the filter in an advanced search.
/advancedsearch
This endpoint allows you to search for a movie or tv show based on various parameters such as release year, IMDB rating, genre, language, etc. The following table shows a description of the parameters you can use for this endpoint.
Parameter | Description |
start_year | Start year you want to search content. You can enter a value between 1970-2020 to get results |
end_year | Last year you wanted to search for content. You can enter a value between 1970-2020 to get results |
min_imdb | Minimum IMDb score value |
max_imdb | MaximumIMDb score value |
genre | use comma-separated values to enter multiple genres, e.g., action, horror, |
language | use comma-separated values to enter multiple values, e.g., English, german |
type | ‘movie’ or ‘show.’ |
sort | Enter values highest-rated, lowest-rated, latest, oldest to sort results accordingly |
page | Number of pages to return |
/getnew
This endpoint can retrieve the latest TV show or movie arrivals. You need to specify the region of OTT providers and optionally the number of pages. For example, the following image shows the list of new TV shows and movie arrivals in the US.
/getadditionalDetails
You can get additional details for a movie or TV show like reviews, quotes, plot summary, number of votes, trailer URL, cast details, etc., from getadditionalDetails endpoint. All you need to specify is its IMDB id.
/getitleDetails
This endpoint retrieves basic information on a movie or tv show such as
- IMDB id
- Title
- Genre
- Runtime
- IMDb rating
- Language,
- Synopsis
- Type
- Image URLs,
- Streaming platforms info
You need to specify the IMDB id of the TV show or movie you want to search about
/getcastDetails
Using this API endpoint, you can get information on a cast such as a name, profession, birth and death year, bio, poster, best titles, etc. This endpoint requires you to include ‘people which you can get from the getadditionalDetails endpoint. The following image shows the response for the people ‘nm0000375’.
Integrating the OTT Details API to an Application
This section will see how to integrate the OTT Details API into a software application with Python, PHP, Ruby, and Javascript providing example code snippets from the API site. We will be using its “getPlatforms” endpoint throughout all the code snippets.
In each code, you need to define values for the ‘X-RapidAPI-key,’ ‘X-RapidAPI-host,’ and ‘accept’ parameters and include them in the request header. The “accept” parameter should always be ‘application/JSON because it has been built to return the response in the JSON format. You can take these values from the API website.
Python Code Snippet (requests)
First of all, install the ‘requests’ python module on your computer. The following python code uses the “requests” library to send a GET request to the endpoint. Define the mandatory search term in the “query string” variable. Then use the URL, header, and the query string in the Request object’s request method to send the API call programmatically. You can also use requests.post method for this purpose.
import requests url = "https://ott-details.p.rapidapi.com/getPlatforms" querystring = {"region":"IN"} headers = { 'x-rapidapi-key': "cJvLRNK0GfdM9WSMbQe3inU7REn8JVy5", 'x-rapidapi-host': "ott-details.p.rapidapi.com" } response = requests.request("GET", url, headers=headers, params=querystring) print(response.text)
PHP Code Snippet (HTTP v2)
First, create a client and a request class object. Then you need to set the API url, request method, query string containing the search keyword, and the header separately from the request object. Finally, send the request through the client objects’ send method.
<?php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://ott-details.p.rapidapi.com/getPlatforms'); $request->setRequestMethod('GET'); $request->setQuery(new http\QueryString([ 'region' => 'IN' ])); $request->setHeaders([ 'x-rapidapi-key' => 'cJvLRNK0GfdM9WSMbQe3inU7REn8JVy5', 'x-rapidapi-host' => 'ott-details.p.rapidapi.com' ]); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody();
Ruby (net::http)
Suppose you are using Rubys’ net::http module, import OpenSSL and URI modules in the beginning. In this instance, bypass SSL certification verification by setting it to ‘VERIFY_NONE..’ Unlike in the above code examples, you can directly set the search keyword in the query string along with the URL.
require 'uri' require 'net/http' require 'openssl' url = URI("https://ott-details.p.rapidapi.com/getPlatforms?region=IN") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = 'cJvLRNK0GfdM9WSMbQe3inU7REn8JVy5' request["x-rapidapi-host"] = 'ott-details.p.rapidapi.com' response = http.request(request) puts response.read_body
Javascript (Axios)
Integrating this API into a Javascript application is pretty straightforward and requires a few lines of code. The following code snippet shows how to call this API using its ‘axios’ module. You can define the parameters, url, headers, and the request method in one javascript object and use Axios. The request method to send the request and retrieve the response.
import axios from "axios"; const options = { method: 'GET', url: 'https://ott-details.p.rapidapi.com/getPlatforms', params: {region: 'IN'}, headers: { 'x-rapidapi-key': 'cJvLRNK0GfdM9WSMbQe3inU7REn8JVy5', 'x-rapidapi-host': 'ott-details.p.rapidapi.com' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); });
Alternatives to the OTT Details API
Following are the similar OTT Movies and TV Series details APIs available on the RapidAPI site.
- Movies/TV show Data (IMDB) API – This API allows you to get Movies and TV Series data that includes results in a JSON format and includes items such as movie & TV Shows specifications, images, posters, trailers, ratings, and more
- Data-imdb API – Retrieves a collection of IMDB information for movies, TV shows, actors. Includes awards, complete biography, youtube trailer url, and many other valuable pieces of information.
- Movies/TV series streaming shows API – You can get any Movie or TV Series or Show streaming links by their IMDB IDs with this API.
Benefits of the OTT Details API
Extensive Functionality
This API is not limited to only a single functionality. It covers basic to advanced TV and movie information like genres, plot summaries, synopsis, reviews, IMDB ratings, image URLs, etc. Therefore, developers can build comprehensive movie and TV series search applications without depending on other APIs.
Easy to Integrate
Almost all the endpoints of OTT Details API need just a few parameters. Thus, you do not have to spend a lot of time writing complicated code. In addition, you can find example code snippets in many programming languages with two or more frameworks or modules. Because of this simplicity, even someone with little to no background using APIs can master the API reasonably quickly.
Freemium API
OTT Details API is a simple and API that costs you only $50 per month to get its full capabilities. It also allows developers to get most of its capabilities free of charge. It will be a huge benefit, particularly for students who learn about APIs and application developers to build innovative applications.
Summary
OTT Details API is a comprehensive and robust API that you can use to get a lot of helpful information about movies and TV shows from OTT providers. This article discussed how to subscribe for it, its available endpoints, benefits, for whom it will be helpful, and provided sample code snippets in Python, PHP, Ruby, and Javascript to show how to use it in an application.
Leave a Reply