Search Movies and Animes

The Search endpoint allows you to search for movies and animes in our database based on various criteria. This powerful search functionality enables you to find specific items or groups of items that match certain parameters, making it easy to implement a search feature in your application.

Endpoint Information

Endpoint URL

{baseUrl}/search
GET

Query Parameters

Use the following query parameters to customize your search request:

  • query: The main search term. This can be a title, an actor's name, or any other relevant search term.
  • page: Specify the page number for paginated results. Default is 1.
  • limit: Set the number of items to return per page. Default is 10.
  • year: Filter items by release year.
  • genre: Filter items by genre.
  • type: Filter search results by type. Available options are 'movies' and 'animes'.

The search results are sorted by relevance to the search query.

Example Responses

200 OK - Successful Response

This response indicates that the search was successful and matching items were found.

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

404 Not Found - No Items Found

This response is returned when no items match the search criteria.

{
  "statusCode": 404,
  "status": "error",
  "message": "No items found matching the search criteria",
  "results": null
}

500 Internal Server Error - Server Failure

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

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

API Demonstration

Try out the Search 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/search?query=&page=1&limit=10&year=&genre=&type=&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.