Important
The new base URL is https://potterapi-fedeperin.vercel.app but you can still use the old one (not recommended) https://potterapi.onrender.com/
PotterAPI is a Harry Potter API developed with Express.js and available in multiple languages.
This API stores information and images of books, characters and spells.
Explore the API and its endpoints interactively using our Harry Potter API Documentation.
This API is available in the following languages:
If there's any problem with the translations, you can open an issue or a pull request.
The endpoints are the following:
Note: The [lang] in the endpoint should be replaced by the corresponding language reference without the brackets (GET /en/books
for example)
GET /[lang]/books
Returns information and images about Harry Potter books.
Key | Type | Value |
---|---|---|
number |
number | The book number |
title |
string | The title of the book in the selected language |
originalTitle |
string | The original book title in English |
releaseDate |
string | The release date |
description |
string | A summary of the book |
pages |
number | The original book's number of pages |
cover |
string | An URL to an image with the original cover of the book |
GET /[lang]/characters
Returns information and images of Harry Potter characters.
Key | Type | Value |
---|---|---|
fullName |
string | The full name of the character |
nickname |
string | The nickname of the character |
hogwartsHouse |
string | The Hogwarts House this character belong to |
interpretedBy |
string | The name of the actor/actress the character was interpreted by in the movies |
children |
object | An array with all the children of the character |
image |
string | An URL to an image of the character |
birthdate |
string | The birthdate of the character. Format "Month Day, Year" |
GET /[lang]/houses
Returns the four Hogwarts Houses with some extra data
Key | Type | Value |
---|---|---|
house |
string | Name of the House |
emoji |
string | An emoji representing the house |
founder |
string | The name of the founder of the house |
colors |
object | An array with the colors in english of the house |
animal |
string | The animal of the house |
GET /[lang]/spells
Returns all the spells mentioned in the saga with a description.
Key | Type | Value |
---|---|---|
spell |
string | The name of the spell |
use |
string | Description of the spell |
You have to change the [lang] by one of the two-letter codes of the languages supported.
Every endpoint has a
/random
, which returns a random item of the full list. For example /en/spells/random
returns a single random spell in English.
Every endpoint (excluding the /random
s) can recieve the following query params:
Param | Recieves | Description |
---|---|---|
index |
number | Returns only one item, the one that on the whole list has the index selected |
max |
number | Returns the whole list cropped by the number passed |
page |
number | If max is used, you can also use this param to indicate where to start cropping |
search |
string | Searches in all the items and returns the best matches |
const fetchSpells = async () => {
const res = await fetch('https://potterapi-fedeperin.vercel.app/en/spells')
const spells = await res.json()
return spells
}
fetch('https://potterapi-fedeperin.vercel.app/es/characters?search=Weasley')
.then(res => res.json())
.then(res => {
console.log(res)
})
import requests
def get_book():
response = requests.get('https://potterapi-fedeperin.vercel.app/en/books')
books = response.json()
return books
With HTTPS
$ git clone https://github.com/fedeperin/potterapi.git
With SSH
$ git clone git@github.com:fedeperin/potterapi.git
Run this to start a local server:
$ npm run dev
Before submitting a PR or making a commit run the following command:
$ npm run test
Thanks to our contributors for their time and effort
![fedeperin](/fedeperin/potterapi/raw/main/readme-assets/contributors/fedeperin.png)
![vlaurencena](/fedeperin/potterapi/raw/main/readme-assets/contributors/vlaurencena.jpg)
![romsendz](/fedeperin/potterapi/raw/main/readme-assets/contributors/romsendz.jpg)
This is a version that unifies my Harry Potter API and my Harry Potter API English, also adding more info. This API is using Express.js instead of json-server.