Skip to content

A Harry Potter rest API that brings information about spells, characters, books and information itself.

Notifications You must be signed in to change notification settings

fedeperin/harry-potter-api-english

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harry Potter API

Important

PotterAPI is a new version of this API, available en multiple languages and updated with new information. I recommend using that one instead of this one.

A Harry Potter Rest API that returns information about spells, characters, books and information itself. I used node.js with the only package json-server for creating it. This Harry Potter API is hosted at Render

For installing the dependencies, execute by terminal with node js installed npm install json-server

How to use

Here is a JavaScript example of fetching the entire API. Just change tha value of the const urlToFetch for changing the URL being fetched. urlToFetch value can be changed by an enpoint of this (or another) API for feching different APIs

const urlToFetch = "https://harry-potter-api-en.onrender.com/db"

fetch(urlToFetch)
	.then((res) => res.json())
	.then((data) => {
		// It brings all data at the API and it shows it at the console
		console.log(data)
	})
	.catch((e) => console.log(e));

Or visit the main page of this API (that comes by default with json-server): https://harry-potter-api-en.onrender.com/

Endpoints


To access an specific element at the API, just secify the ID number of that element at the end of the route

Examples:


GitHub Repository of the Spanish version of this same API: https://github.com/fedeperin/harry-potter-api/