Popular Movies

The Popular Movies endpoint provides a curated list of the most popular movies in our database. This endpoint returns a collection of movies sorted by their popularity, allowing you to showcase trending and widely-appreciated films. It's an excellent feature for highlighting top movies on your application's homepage or in a dedicated popular movies section.

Endpoint Information

Endpoint URL

{baseUrl}/movies/popular
GET

Query Parameters

Use the following query parameters to customize your request for popular 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 popular movies to return per page. Default is 10.

The movies are automatically sorted by popularity in descending order, so you'll always get the most popular 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 Popular 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/popular?page=1&limit=1&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.