Top Rated Movies

The Top Rated Movies endpoint provides a curated list of the highest-rated movies in our database. This endpoint returns a collection of movies sorted by their rating, allowing you to showcase critically acclaimed and user-favorite films. It's an excellent feature for highlighting the best movies on your application's homepage or in a dedicated top-rated movies section.

Endpoint Information

Endpoint URL

{baseUrl}/movies/top-rated
GET

Query Parameters

Use the following query parameters to customize your request for top-rated movies. These parameters allow you to control the pagination of results, ensuring you get the most relevant data for your needs:

  • page: Specify the page number for paginated results. Default is 1.
  • limit: Set the number of top-rated movies to return per page. Default is 10.

The movies are automatically sorted by rating in descending order, so you'll always get the highest-rated movies first.

Example Responses

200 OK - Successful Response

This response indicates that the request was successful and the movies were retrieved.

{
  "statusCode": 200,
  "status": "success",
  "message": "Movies fetched successfully",
  "results": {
    "movies": [],
    "totalPages": 0,
    "currentPage": 0
  }
}

404 Not Found - No Movies Found

This response is returned when no movies match the search criteria in the database.

{
  "statusCode": 404,
  "status": "error",
  "message": "No movies found",
  "results": null
}

500 Internal Server Error - Server Failure

This response indicates that there was an internal server error that prevented the request from being fulfilled.

{
  "statusCode": 500,
  "status": "error",
  "message": "Internal server error",
  "results": null
}

API Demonstration

Try out the Top Rated Movies API with this interactive demonstration. Adjust the parameters below and click the button to make an API call.

API Call Example

import axios from 'axios';

const fetchMovies = async () => {
  try {
    const response = await axios.get('{baseUrl}/api/v1/movies/top-rated?page=1&limit=10&api_token=undefined');
    console.log(response.data);
  } catch (error) {
    console.error('Error fetching movies:', error);
  }
};

fetchMovies();

Please sign in and obtain an API token to use this demonstration.