GOT.DATA API

This document contains all current API routes to our GoT database. It consists of two different data sets:

Please use the API routes as described below.


Show API Routes

The following table shows all possible API routes. Please use

https://gotdata.northeurope.cloudapp.azure.com

as base url followed by the paths described below.

Model Main Path API endpoint type* description
Animal /api/show/animals GET returns all animals
/:name GET returns animal by name
/byHabitat/:location GET returns animal by habitat/location
Age /api/show/ages GET returns all character ages
/:name GET returns characters age by name
/byAge/:age GET returns all character names with the specified age
Assassin /api/show/assassins GET returns all assassins
/:name GET returns assassin by name
Bastard /api/show/bastards GET returns all bastards
/:name GET returns bastard by name
Battle /api/show/battles GET returns all battles
/:name GET returns battle by name
/bySlug/:slug GET returns battle by page name
/byLocation/:location GET returns battle by location
/byConflict/:conflict GET returns battle by conflict
City /api/show/cities GET returns all cities
/:name GET returns city by name
/byLocation/:location GET returns city by location
Character /api/show/characters GET returns all characters
/:name GET returns character by name
/bySlug/:slug GET returns character by page title
/byHouse/:house GET returns character by house
/updateGeneral POST updates general plod, longevity, longevityStart, specifiy these fields in https body (x-www-form-urlencoded)
/updateGroupB POST updates plod, longevity, longevityStart, specify slug and plod in https body (x-www-form-urlencoded)
/updateGroupC POST updates plod, longevity, longevityStart, specify these fields in https body (x-www-form-urlencoded)
Castle /api/show/castles GET returns all castles
/:name GET returns castle by name
/byLocation/:location GET returns castles by location
Episode /api/show/episodes GET returns all episodes
/:title GET returns episode by title
Event /api/show/events GET returns all events
/:name GET returns event by name
/bySlug/:slug GET returns event by slug
/byConflict/:conflict GET returns event by conflict
/byDate/:date GET returns all events at a specific date
House /api/show/houses GET returns all houses
/:name GET returns house by name
Region /api/show/regions GET returns all cities
/:name GET returns city by name
/byLocation/:location GET returns region by location
Religion /api/show/religions GET returns all religions
/:title GET returns religion by title
Town /api/show/towns GET returns all towns
/:name GET returns town by name
/byLocation/:location GET returns town by location
/byRuler/:name GET returns town by ruler
/byReligion/:religion GET returns town by religion

* POST requests will be added soon

Examples:

    https://gotdata.northeurope.cloudapp.azure.com/api/show/characters/Jon_Snow
    https://gotdata.northeurope.cloudapp.azure.com/api/show/towns

Possible error messages:

“No XYZ matched your criteria”
“XYZ collection empty. Scraping should be started anytime soon…”


Book API Routes

The following table shows all possible API routes. Please use

https://gotdata.northeurope.cloudapp.azure.com

as base url followed by the paths described below.

Model Main Path API endpoint type* description
Age /api/book/ages GET returns all character ages
/:name GET returns characters age by name
/byAge/:age GET returns all character names with the specified age
City /api/book/cities GET returns all cities
/:name GET returns city by name
/byLocation/:location GET returns city by location
Character /api/book/characters GET returns all characters
/:name GET returns character by name
/bySlug/:slug GET returns character by page title
/byHouse/:house GET returns character by house
/updateGeneral POST updates general plod, longevity, longevityStart, specifiy these fields in https body (x-www-form-urlencoded)
/updateGroupB POST updates plod, longevity, longevityStart, specify slug and plod in https body (x-www-form-urlencoded)
/updateGroupC POST updates plod, longevity, longevityStart, specify these fields in https body (x-www-form-urlencoded)
CharacterPath /api/book/characterPaths GET returns all characters
/:name GET returns character by name
CharacterLocation /api/book/characterLocations GET returns all characters
/:name GET returns character by name
/bySlug/:slug GET returns characters locations by slug
Continents /api/book/continents GET returns all continents
/:name GET returns continent by name
Culture /api/book/cultures GET returns all cultures
/:name GET returns culture by name
Event /api/book/events GET returns all events
/:name GET returns event by name
House /api/book/houses GET returns all houses
/:name GET returns house by name
Region /api/book/regions GET returns all cities
/:name GET returns city by name
/byContinent/:continent GET returns region by continent

* POST requests will be added soon

Examples:

    https://gotdata.northeurope.cloudapp.azure.com/api/book/characters/Jon_Snow
    https://gotdata.northeurope.cloudapp.azure.com/api/book/continents

Data Models

A short overview of the different data models:

Show Data Models

AnimalModel

	name 	: {type: String, required: true, unique: true},
	type 	: {type: String},
	diet 	: {type: String},
	status 	: {type: String},
	habitat : [{type: String}],
	range 	: [{type: String}]

AssassinModel

	name : {type: String, required: true, ref: 'CharacterFandom'}

BastardModel

	name : {type: String, required: true, ref: 'CharacterFandom'}

BattleModel

	name 			: {type: String, required: true, unique: true},
	slug 			: {type: String},
	conflict 		: {type: String},
	dateOfBattle 	: {type: Number},
	location 		: [{type: String, ref: 'Region'}],
	factionsOne 	: [{type: String, ref: 'House'}],
	factionsTwo 	: [{type: String, ref: 'House'}],
	commandersOne 	: [{type: String, ref: 'CharacterFandom'}],
	commandersTwo 	: [{type: String, ref: 'CharacterFandom'}],
	forcesOne 		: [{type: String}],
	forcesTwo 		: [{type: String}],
	casualties 		: [{type: String, ref: 'CharacterFandom'}],
	createdAt 		: {type: Date, default: Date.now},
	updatedAt 		: {type: Date, default: Date.now}

CharacterModel

    name            : {type: String, required: true, unique: true},
    slug            : {type: String, required: true},
    nicknames       : [String],                               
    titles          : [String],                                                        
    gender          : String,
    image           : String,                                                       
    alive           : Boolean,
    birth           : Number,
    death           : Number,
    origin          : String,
    mother          : {type: String, ref: 'CharacterFandom'},
    father          : {type: String, ref: 'CharacterFandom'},
    siblings        : [{type: String, ref: 'CharacterFandom'}],
    house           : {type: String, ref: 'House'},
    spouse          : {type: String, ref: 'CharacterFandom'},
    lovers          : [{type: String, ref: 'CharacterFandom'}],

    cultures        : [{type: String, ref: 'Culture'}],
    religions       : [{type: String, ref: 'ReligionFandom'}],
    allegiances     : [{type: String, ref: 'CharacterFandom'}],

    first_seen      : {type: String, ref: 'EpisodeFandom'},
    seasons         : [Number],
    appearances     : [{type: String, ref: 'EpisodeFandom'}],

    actor           : String,
    createdAt       : {type: Date, default: Date.now},
    updatedAt       : {type: Date, default: Date.now},

CastleModel

	name 		: {type: String, required: true, unique: true},
	location 	: {type: String, ref: "RegionFandom"},
	type 		: {type: String},
	religion 	: [{type: String, ref: "ReligionsFandom"}],
	rulers 		: [{type: String, ref: "House"}],
	age 		: {type: Number},
	founder 	: [{type: String}]

CityModel

	name 			: {type: String, required: true, unique: true},
	location 		: {type: String, ref: "Continent"},
	type 			: {type: String},
	rulers 			: [{type: String}],
	religion 		: [{type: String, ref: "ReligionsFandom"}],
	founder 		: [{type: String, ref: "CharacterFandom"}],
	placesOfNote 	: [{type: String}]

Episode Model

    title           : {type: String, required: true, unique: true},
    number          : Number,
    season          : Number,
    episode         : Number,
    image           : String,
    date            : Date,
    viewers         : Number,

    runtime         : Number,
    written_by      : String,
    directed_by     : String,
    preview_text    : String,

    characters      : [{type: String, ref: 'CharacterFandom'}],
    deaths          : [{type: String, ref: 'CharacterFandom'}],
    places          : [{type: String, ref: 'City'}],
    
    predecessor     : {type: String, ref: 'EpisodeFandom'},
    successor       : {type: String, ref: 'EpisodeFandom'},
    
    createdAt		: {type: Date, default: Date.now},
    updatedAt		: {type: Date, default: Date.now}

RegionModel

	name 			: {type: String, required: true, unique: true},
	location 		: {type: String, ref: "Continent"},
	geography 		: {type: String},
	rulers 			: [{type: String, ref: "CharacterFandom"}],
	religion 		: [{type: String, ref: "ReligionsFandom"}],
	culture 		: [{type: String, ref: "Culture"}],
	regionCapital 	: {type: String},
	cities 			: [{type: String}],
	towns 			: [{type: String}],
	castles 		: [{type: String, ref: "CastleFandom"}],
	founder 		: [{type: String, ref: "CharacterFandom"}],
	placesOfNote 	: [{type: String}]

Religion Model

    name        : {type: String, required: true, unique: true},
    slug        : String,
    image       : String,

    type        : [String],
    clergy      : {type: String, ref: "CharacterFandom"},
    locations   : [{type: String, ref: "RegionFandom"}],
    leaders     : [{type: String, ref: "CharacterFandom"}],
    center      : String,

    neighbors   : [{type: String, ref: "RegionFandom"}],
    cultures    : [{type: String, ref: "Culture"}],
    events      : [{type: String, ref: "Event"}]

PageRank Model

    title       : {type: String, required: true, unique: true},
    rank        : Number

TownModel

	name 		: {type: String, required: true, unique: true},
	location 	: {type: String, ref: "Continent"},
	type 		: {type: String},
	rulers 		: [{type: String}],
	religion 	: [{type: String, ref: "ReligionsFandom"}]

Book Data Models

Age Model

name 			:  {type:  String, required:  true, unique:  true},
startDate 		:  {type:  Number},
endDate 		:  {type:  Number},
predecessor		:  {type:  String, ref:  'Age'},
successor 		:  {type:  String, ref:  'Age'}

Character Model

name 				: {type:  String, required:  true, unique:  true},  // Rhaegar
titles 				: [String],  // Prince of Dragonstone Ser
male 				: Boolean,  // Male
culture 			: String,  // Valyrian
age 				: {type:  Number, min:  1, max:  200},  // ??
dateOfBirth 		: Number,  // 259 AC
dateOfDeath 		: Number,  // 283 AC
actor 				:  String,
mother 				:  {type:  String, ref:  'Character'},
father 				:  {type:  String, ref:  'Character'},
heir 				:  {type:  String, ref:  'Character'},
placeOfBirth 		:  {type:  String, ref:  "Region"},  // Summerhall
placeOfDeath 		:  {type:  String, ref:  "Region"},  // Trident
house 				:  {type:  String, ref:  "House"},
plod 				:  {type:  Number, default:  0.0},  
createdAt 			:  {type:  Date, default:  Date.now},
updatedAt 			:  {type:  Date, default:  Date.now},
spouse 				: [{type:  String, ref:  'Character'}],
children 			: [{type:  String, ref:  'Character'}],
allegiance 			: [{type:  String, ref:  'Character'}],
books 				: [String],
placeOfLastVisit	:  {type:  String, ref:  'Region'},
imageLink 			:  String,
slug 				:  String,
hasPath 			:  Boolean

Character Location Model

name 		:  {type:  String, ref:  'Character', required:  true, unique:  true},
slug		:  {type:  String, unique:  true, required:  true},
locations	: [String]

Character Path Model

name	:  String,
path	:  Array

City Model

name 		:  {type:  String, required:  true, unique:  true},
coordX 		:  String,  //Mongoose only supports Number (Integer)
coordY 		:  String,  //For floats or doubles, it automatically converts it to String
type 		:  String,
priority 	:  {type:  Number, min:  0, max:  6},
link 		:  String,
continent	:  {type:  String, ref:  "Continent"},
regions 	: [{type:  String, ref:  "Region"}]

Continent Model

name 				: {type:  String, required:  true, unique:  true},
neighbors 			: [{type:  String, ref:  "Continent"}],
cardinalDirection	: String  // west, east, north, south

Culture Model

name	:  {type:  String, required:  true, unique:  true},

Event Model

name		: {type:  String}, 
date		: Number,
age 		: {type:  String, ref:  'Age'},
createdAt	: {type:  Date, default:  Date.now},
updatedAt	: {type:  Date, default:  Date.now},

House Model

name 				:  {type:  String, required:  true, unique:  true},
image 				:  String,
titles 				: [String],
coatOfArms	 		:  String,  // Sable, a dragon thrice-headed gules
words 				:  String,  // Fire and Blood
currentLord 		:  {type:  String, ref:  "Character"},  // Queen Daenerys Targaryen
overlords 			: [{type:  String, ref:  "House"}],  // None
seat 				:  String,
region 				:  String,
ancestralWeapon		: [String],  // Blackfyre and Dark Sister
founded 			:  String,  // > 126 BC, Age of Heroes
founder 			:  String,
cadetBranch 		:  String,  // House Blackfyre is the cadet branch of House Targaryen
heir 				:  String,
isExtinct 			:  Boolean,
createdAt 			:  {type:  Date, default:  Date.now},
updatedAt 			:  {type:  Date, default:  Date.now}

Region Model

name 			: {type:  String, required:  true, unique:  true},
continent 		: {type:  Schema.Types.ObjectId, ref:  "Continent"},
neighbors 		: [{type:  Schema.Types.ObjectId, ref:  "Region"}],
cultures 		: [{type:  Schema.Types.ObjectId, ref:  "Culture"}],
events 			: [{type:  Schema.Types.ObjectId, ref:  "Event"}],
color 			: String,
borders 		: [[String]],
highlights		: [String]

Questions & Feedback

Please feel free to ask us (Team A) anything on Slack! We are happy to help!
Bear in mind that this API is not finished yet. Some attribute names may change and more data models will follow! Stay tuned.