/planets/4
Request:
fetch("https://swapi.info/api/planets/4")
.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": "Hoth",
"rotation_period": "23",
"orbital_period": "549",
"diameter": "7200",
"climate": "frozen",
"gravity": "1.1 standard",
"terrain": "tundra, ice caves, mountain ranges",
"surface_water": "100",
"population": "unknown",
"residents": [],
"films": [
"https://swapi.info/api/films/2"
],
"created": "2014-12-10T11:39:13.934000Z",
"edited": "2014-12-20T20:58:18.423000Z",
"url": "https://swapi.info/api/planets/4"
}