API Documentation by Team Aquascript

Aquascript Movies API Documentation

Overview

The Aquascript Movies API provides a rich collection of movie data in JSON format, ideal for developers building applications to showcase, filter, or analyze movies. It contains genre lists, metadata, and downloadable links.

API Endpoints

File Structure

moviesdata.json contains:

moviesdata++.json is an array of objects, where each object contains:

Using the API

Use JavaScript's fetch() to retrieve data from the API:

fetch('path/to/moviesdata.json')
  .then(response => response.json()) // Converts response into JSON
  .then(data => {
    console.log(data); // Logs the data for debugging
  });

Displaying Movies (Example)

HTML structure to display movies:

<div id="movie-list"></div>

JavaScript to populate the movie list:

document.addEventListener('DOMContentLoaded', () => {
  const movieList = document.getElementById('movie-list'); // Grabs the container element

  // Fetch movie data from JSON file
  fetch('path/to/moviesdata.json')
    .then(response => response.json()) // Converts data into JSON format
    .then(data => {

      // Iterate through the movies array and create individual movie cards
      data.movies.forEach(movie => {
        const movieCard = document.createElement('div'); // Creates a new div element for each movie
        
        // Populate the movie card with relevant movie data using template literals
        movieCard.innerHTML = `
          <h3>${movie.title} (${movie.year})</h3>
          <p><strong>Director:</strong> ${movie.director}</p>
          <p><strong>Genres:</strong> ${movie.genres.join(', ')}</p>
          <img src="${movie.posterUrl}" alt="${movie.title}" width="150">
        `;

        // Append each card to the main movie list container
        movieList.appendChild(movieCard);
      });

    })
    .catch(error => console.error('Error loading movie data:', error)); // Handle errors gracefully
});

Best Practices

Conclusion

The Aquascript Movies API is a versatile, developer-friendly way to integrate movie data into your applications. Use it to create genre filters, movie cards, or download features. It’s perfect for developers who want to display rich, dynamic movie content in their projects.