API Documentation
Introduction
Welcome to the API documentation for the Horus Heresy API. This API was made in 2023 by Rasmus Bremholm and started out as en experiement in ExpressJS and Supabase but grev into this fullstack app you are reading now.
To get started read the intro chapter on how to use the API down below.
Quick Start
The fastest way to get started is by visiting our first API endpoint.
https://horus-heresy-next.vercel.app/api/legions
Here you will find a list of all legions and the data that goes long with that legion. Data like Primarchs name, homeworld, size of army and what allegence they had during the end of the Horus Heresy.
Get Legion by ID
To get info on a specific legion you can use the following endpoint.
https://horus-heresy-next.vercel.app/api/legion/[id]
The id field needs to be populated with a number between 1 and 20. Otherwise the API will return with a 500 error code telling you that the id is out of the scope.
I made sure the ID field corresponds to each Legions number instead of beeing just an index. This way the user gets a two in one, both legiion number and a convinient id to select specific legions.
For thoose not knowing what legion corresponds to each number i have included a list below.
- Dark Angels
- [Redacted]
- Emperor's Children
- Iron Warriors
- White Scars
- Space Wolves
- Imperial Fists
- Night Lords
- Blood Angels
- Iron Hands
- [UNKNOWN]
- World Eaters
- Ultramarines
- Death Guard
- Thousand Sons
- Sons of Horus (Luna Wolves)
- Word Bearers
- Salamanders
- Raven Guard
- Alpha Legion
FUN FACT:
If you are wondering about entry 2 and 11 thoose legions are expunged from the Imperial records in the Lore. So if you see entries such as [redacted] or [deleted] or even [unknown] I still added this info manually for "lore friendly" effect.
Legion Data
Each legion returns as a single object with properties such as "id", "name" and "description". These are all properties of the single legion object so when acessing the properties you can just use.
const data = legions.name
This makes it easier for me personally. That everything isnt packed in a single data object that you have to filter out stuff from. If you have suggestions on if I should change this, please shoot me a messege and i'll fix it right up.
Here is a list of all the current properties as of v0.1.0. The list of properties and what they mean should be obvious, and i tried really hard to keep the naming as clear and concise as possible.
"id":int4
"name":varchar(255)
"description":text
"primarch":varchar(255)
"traitor":bool
"homeworld":varchar(255)
"colors":json (Object containing properties for "primary" and "secondary" colors.)
"size":int8 (Size of the legions army, its usually in the 100,000 range.)
"characters":json (Same as color, will be a list of noteworthy characters from the legion.)
"quote":varchar(255)
"battlecry":varchar(255)
NOT USED RIGHT NOW
"primarch_image_url":varchar(255)
"homeworld_image_url":varchar(255)
Fun fact?
I choose not to include the primarch image or homeworld image since i couldnt solve the image hosting. Ill probably modify the default endpoint to exclude theese field in the future. Right now the URL's will just point to the image paths of this project.
Get all Traitor Legions
To get all the traitor legions (bad guys) use the following endpoint.
https://horus-heresy-next.vercel.app/api/traitors
Get all Loyalist Legions
On the other hand, if you want a list of all the goodies you can use the following endpoint.
https://horus-heresy-next.vercel.app/api/loyalists
Too see all theese beeing used practically, please visit the Legions page.