Updated on September 14, 2023

Create an actor

POST

You can add a new actor to the Monolito Movies database using the Monolito Movies API. This document provides instructions on how to make a POST request to create an actor entry.

Endpoint

To create an actor, make a POST request to the following endpoint:

POST /actors

Request

Here's an example of how to make a POST request to create a new actor using JavaScript:

const newActor = {
  name: "New Actor Name",
  birthdate: "YYYY-MM-DD",
  nationality: "Nationality (optional)",
  biography: "Actor Biography (optional)"
};

const apiUrl = "https://api.monolitomovies.com/v1/actors";

fetch(apiUrl, {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify(newActor)
})
  .then(response => response.json())
  .then(data => {
    console.log("New Actor Created:", data);
  })
  .catch(error => {
    console.error("Error:", error);
  });

In this example, we create a JavaScript object representing the actor's details and use the fetch function to make an HTTP POST request to the /actors endpoint. The API will create a new actor entry based on the provided data.

Response

Upon successful creation, the API will respond with the newly created actor's details in JSON format, including its unique identifier (id) and any additional information provided during the creation process.

Response Example

{
  "id": 789,
  "name": "New Actor Name",
  "birthdate": "YYYY-MM-DD",
  "nationality": "Nationality (optional)",
  "biography": "Actor Biography (optional)"
}

You can now create new actor entries in the Monolito Movies database via the API. Next, we'll cover how to update actor information using a PATCH request.