/films/2

homecaret-rightfilmscaret-right

2

API Endpoint:

Request:

fetch("https://swapi.info/api/films/2")
    .then((res) => res.json()) // Parse the JSON content from the API to be consumed
    .then((json) => console.log(json)) // Log the JSON response to your console
    .catch((error) => console.error(error)) // Log the API error (if any) to your console

Result:

{
  "title": "The Empire Strikes Back",
  "episode_id": 5,
  "opening_crawl": "It is a dark time for the\r\nRebellion. Although the Death\r\nStar has been destroyed,\r\nImperial troops have driven the\r\nRebel forces from their hidden\r\nbase and pursued them across\r\nthe galaxy.\r\n\r\nEvading the dreaded Imperial\r\nStarfleet, a group of freedom\r\nfighters led by Luke Skywalker\r\nhas established a new secret\r\nbase on the remote ice world\r\nof Hoth.\r\n\r\nThe evil lord Darth Vader,\r\nobsessed with finding young\r\nSkywalker, has dispatched\r\nthousands of remote probes into\r\nthe far reaches of space....",
  "director": "Irvin Kershner",
  "producer": "Gary Kurtz, Rick McCallum",
  "release_date": "1980-05-17",
  "characters": [
    "https://swapi.info/api/people/1",
    "https://swapi.info/api/people/2",
    "https://swapi.info/api/people/3",
    "https://swapi.info/api/people/4",
    "https://swapi.info/api/people/5",
    "https://swapi.info/api/people/10",
    "https://swapi.info/api/people/13",
    "https://swapi.info/api/people/14",
    "https://swapi.info/api/people/18",
    "https://swapi.info/api/people/20",
    "https://swapi.info/api/people/21",
    "https://swapi.info/api/people/22",
    "https://swapi.info/api/people/23",
    "https://swapi.info/api/people/24",
    "https://swapi.info/api/people/25",
    "https://swapi.info/api/people/26"
  ],
  "planets": [
    "https://swapi.info/api/planets/4",
    "https://swapi.info/api/planets/5",
    "https://swapi.info/api/planets/6",
    "https://swapi.info/api/planets/27"
  ],
  "starships": [
    "https://swapi.info/api/starships/3",
    "https://swapi.info/api/starships/10",
    "https://swapi.info/api/starships/11",
    "https://swapi.info/api/starships/12",
    "https://swapi.info/api/starships/15",
    "https://swapi.info/api/starships/17",
    "https://swapi.info/api/starships/21",
    "https://swapi.info/api/starships/22",
    "https://swapi.info/api/starships/23"
  ],
  "vehicles": [
    "https://swapi.info/api/vehicles/8",
    "https://swapi.info/api/vehicles/14",
    "https://swapi.info/api/vehicles/16",
    "https://swapi.info/api/vehicles/18",
    "https://swapi.info/api/vehicles/19",
    "https://swapi.info/api/vehicles/20"
  ],
  "species": [
    "https://swapi.info/api/species/1",
    "https://swapi.info/api/species/2",
    "https://swapi.info/api/species/3",
    "https://swapi.info/api/species/6",
    "https://swapi.info/api/species/7"
  ],
  "created": "2014-12-12T11:26:24.656000Z",
  "edited": "2014-12-15T13:07:53.386000Z",
  "url": "https://swapi.info/api/films/2"
}
eye-open
Good