API

Free Movie Mock REST API Documentation

Free Movie Mock REST API Documentation
117 views
4 min read
#API

The MockX Movie API offers a robust platform for developers to manage movie records, enabling functionalities such as adding new movies, querying existing ones, updating movie details, and deleting records. This guide outlines the API endpoints available for interacting with movie data.

Endpoints Overview

The Movie API includes endpoints for various operations related to movie data management:

  • GET /: Retrieves all movies.
  • GET /search: Searches movies based on query parameters.
  • GET /genres: Fetches a list of all movie genres.
  • GET /:id: Retrieves a specific movie by ID.
  • GET /genre/:genreName: Fetches movies by genre.
  • POST /add: Adds a new movie.
  • PUT /:id: Updates an entire movie record by ID.
  • PATCH /:id: Partially updates a movie record by ID.
  • DELETE /:id: Deletes a movie record by ID.

Get All Movies

Fetch a comprehensive list of movies.

GET https://api.mockx.net/movies

Parameters:

limit: Limits the number of movies returned. skip: Skips a specified number of movies. Example Response:

{
  "movies": [
    {
      "id": 261,
      "title": "Government back plant",
      "year": 1992,
      "genre": [
        "Drama",
        "Horror"
      ],
      "director": "Courtney Johnson",
      "cast": [
        "Tara Garcia",
        "Shawn King",
        "Diane Martinez"
      ],
      "summary": "Part significant really night. Purpose plant box own.",
      "rating": 7.2
    },
    ...
  ],
  "total": 500,
  "skip": 0,
  "limit": 20
}

Search Movies

Search for movies based on a query parameter.

GET https://api.mockx.net/movies/search?q=Future

Parameters:

q: The search query. Example Response:

{
  "movies": [
    {
      "id": 261,
      "title": "Government back plant",
      "year": 1992,
      "genre": [
        "Drama",
        "Horror"
      ],
      "director": "Courtney Johnson",
      "cast": [
        "Tara Garcia",
        "Shawn King",
        "Diane Martinez"
      ],
      "summary": "Part significant really night. Purpose plant box own.",
      "rating": 7.2
    },
    ...
  ],
  "total": 10,
  "skip": 0,
  "limit": 10
}

Get Movie Genres

Retrieve a list of unique movie genres.

GET https://api.mockx.net/movies/genres

Example Response:

{
  "genres": ["Romance", "Sci-Fi", "Comedy"]
}

Get Movie by ID

Fetch detailed information about a specific movie.

GET https://api.mockx.net/movies/{id}

Parameters:

id: The unique identifier of the movie. Example Response:

{
  "movie": {
      "id": 78,
      "title": "Serve seven race",
      "year": 1984,
      "genre": [
        "Action",
        "Comedy"
      ],
      "director": "Liam Walker",
      "cast": [
        "Shelby Parker",
        "Kristi Hull",
        "Joanna Estes",
        "Mark Armstrong",
        "Joshua Ward"
      ],
      "summary": "Health kid data leg more. Charge move class too raise event air.",
      "rating": 6.3
    }
}

Get Movies by Genre

Retrieve movies that match a specific genre.

GET https://api.mockx.net/movies/genre/{genreName}

Parameters:

genreName: The name of the genre. Example Response:

{
  "movies": [
    {
      "id": 78,
      "title": "Serve seven race",
      "year": 1984,
      "genre": [
        "Action",
        "Comedy"
      ],
      "director": "Liam Walker",
      "cast": [
        "Shelby Parker",
        "Kristi Hull",
        "Joanna Estes",
        "Mark Armstrong",
        "Joshua Ward"
      ],
      "summary": "Health kid data leg more. Charge move class too raise event air.",
      "rating": 6.3
    },
    ...
  ]
}

Add New Movie

Add a new movie to the collection.

POST https://api.mockx.net/movies/add

Body: Include movie details such as title, year, genre, director, cast, summary, and rating in the request body.

{
    "id": 750,
    "title": "Serve seven race",
    "year": 1984,
    "genre": [
        "Action",
        "Comedy"
    ],
    "director": "Liam Walker",
    "cast": [
        "Shelby Parker",
        "Kristi Hull",
        "Joanna Estes",
        "Mark Armstrong",
        "Joshua Ward"
    ],
    "summary": "Health kid data leg more. Charge move class too raise event air.",
    "rating": 6.3
}

Example Response:

{
  "title": "New Horizon",
  "year": 2023,
  "director": "Imran",
  "summary": "Really great movie",
  "rating": 5.2,
  "genre": "Action,Comedy",
  "cast":  "Shelby Parker,Kristi Hull"
}

Update Movie by ID

Modify the details of an existing movie.

PUT https://api.mockx.net/movies/{id}

Parameters:

id: The unique identifier of the movie to be updated. Body: Include the movie details to be updated in the request body.

 {
      "title": "Serve seven race",
      "year": 1984,
      "genre": [
        "Action",
        "Comedy"
      ],
      "director": "Liam Walker",
      "cast": [
        "Shelby Parker"
      ],
      "summary": "Health kid data leg more. Charge move class too raise event air.",
      "rating": 6.3
    }

Example Response:

 {
      "title": "Serve seven race",
      "year": 1984,
      "genre": [
        "Action",
        "Comedy"
      ],
      "director": "Liam Walker",
      "cast": [
        "Shelby Parker"
      ],
      "summary": "Health kid data leg more. Charge move class too raise event air.",
      "rating": 6.3
    }

Delete Movie by ID

Remove a movie from the collection.

DELETE https://api.mockx.net/movies/{id}

Parameters:

id: The unique identifier of the movie to be deleted. Example Response:

{
  "message": "Movie with id '{id}' successfully deleted."
}
MockX offers free, reliable mock APIs for easy testing and development, ideal for developers seeking to enhance their workflow without the complexities of setting up any server.
Copyright © 2024. Made with ♥ by MockX.net