/planets/5
Request:
fetch("https://swapi.info/api/planets/5")
.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:
{
"name": "Dagobah",
"rotation_period": "23",
"orbital_period": "341",
"diameter": "8900",
"climate": "murky",
"gravity": "N/A",
"terrain": "swamp, jungles",
"surface_water": "8",
"population": "unknown",
"residents": [],
"films": [
"https://swapi.info/api/films/2",
"https://swapi.info/api/films/3",
"https://swapi.info/api/films/6"
],
"created": "2014-12-10T11:42:22.590000Z",
"edited": "2014-12-20T20:58:18.425000Z",
"url": "https://swapi.info/api/planets/5"
}