Documentation
Getting started with Time Loops API
Welcome to Time Loops API, your one-stop destination for real-world data on Music Albums, Quotes, Software Tools and Skyscrapers. This API offers authentic and detailed information that you can use to power your music apps, quotes apps, architecture projects, and software tools directories.
What You Get
Endpoint | Description |
---|---|
Music Albums | Detailed information about music albums, including artist, genre, release date, and more. |
Quotes | A collection of insightful quotes from a variety of categories and authors. |
Skyscrapers | Data about famous buildings, including architects, architectural styles, construction dates, and more. |
Software Tools | Information about software tools, including descriptions, usage, creators, and more. |
Supported Operations
Time Loops API supports a full set of CRUD operations, allowing you to:
- Create (POST): Simulate adding new records for music albums, quotes, buildings or software tools.
- Read (GET): Retrieve detailed information on all available categories and individual items.
- Update (PUT): Replace an entire existing record with a new one.
- Update (PATCH): Modify specific fields of an existing record.
- Delete (DELETE): Simulate the removal of existing records.
Shapes
These are the expected data shapes when fetching, using TypeScript as an example.
You can find all types here or copy them directly from the boxes below.
General types such as Month, CustomDate and NamedLink: Used in Album and Skyscraper types.
export type Month =
| 'January' | 'February' | 'March' | 'April'
| 'May' | 'June' | 'July' | 'August'
| 'September' | 'October' | 'November' | 'December';
export type NamedLink = {
link: string;
name: string;
};
export type CustomDate = {
day: number;
month: Month;
year: number;
};
1. Albums
export type MusicAlbum = {
id: number;
title: string;
artist: string;
description: string;
releaseDate: CustomDate;
genre: string;
label: NamedLink[];
wiki: string;
};
2. Quotes
export type Quote = {
id: number;
quote: string;
author: string;
category: string;
};
3. Skyscrapers (all types)
type SkyscraperType =
| 'Commercial'
| 'Office'
| 'Retail'
| 'Residential'
| 'Hotel'
| 'Shopping Mall';
type Area = {
city: string;
country: string;
mapsLink: string;
street: string;
};
type GalleryItem = {
id: number;
source: string;
alt: string;
};
export type Skyscraper = {
architects: NamedLink[];
architectureStyle: NamedLink;
constructionEnded: CustomDate;
constructionStarted: CustomDate;
floorArea: number;
floorCount: number;
gallery: GalleryItem[];
height: number;
informationParagraphs: string[];
location: Area;
numberOfElevators: number;
openedDate: CustomDate;
photo: string;
slug: string;
subtitle: string;
title: string;
type: SkyscraperType[];
website: string;
wiki: string;
};
4. Software Tools (all types)
type Creator = {
name: string;
wiki: string;
};
type Category =
| 'programming-language' | 'runtime'
| 'framework' | 'library' | 'query-language'
| 'relational-database-management-system';
export type SoftwareTool = {
id: number;
title: string;
description: string;
image: string;
usage: string;
category: Category;
creators: Creator[];
yearCreated: number;
wiki: string;
};
Example Usage
Here’s how you can start using Time Loops API in your project:
Read a list (GET request)
fetch('https://timeloopsapi.com/albums')
.then(response => response.json())
.then(data => console.log('Albums:', data))
.catch(error => console.error('Error:', error));
Read a Single item (GET request)
fetch('https://timeloopsapi.com/albums/2')
.then(response => response.json())
.then(data => console.log('Album:', data))
.catch(error => console.error('Error:', error));
Create a Single item (POST request)
To add a new music album, send a POST request to the albums endpoint.
const newAlbum: MusicAlbum = {
id: 1,
title: 'Experience',
artist: 'The Prodigy',
description: 'Experience is the debut studio album by the Prodigy.',
releaseDate: {
day: 28,
month: 'Sept',
year: 1992,
},
genre: 'Electronic',
label: [
{
name: 'XL Recordings',
link: 'https://en.wikipedia.org/wiki/XL_Recordings'
}
],
wiki: 'https://en.wikipedia.org/wiki/Experience_(The_Prodigy_album)',
};
fetch('https://timeloopsapi.com/albums', {
method: 'POST',
body: JSON.stringify(newAlbum)
})
.then(response => response.json())
.then(data => console.log('New album added:', data))
.catch(error => console.error('Error:', error));
Delete a Single item (DELETE request)
Deleting a single item is straightforward:
fetch('https://timeloopsapi.com/software-tools/7', {
method: 'DELETE'
})
.then(response => response.json())
.then(data => console.log('Software Tool deleted:', data))
.catch(error => console.error('Error:', error));
Update a Single item (PUT request)
The PUT request will replace the entire resource with the new data. All fields must be provided, and missing fields will be overwritten.
const updatedQuote = {
quote: "It is not that I'm so smart, it's just that I stay with problems longer",
author: "Albert Einstein",
category: "wisdom"
};
fetch('https://timeloopsapi.com/quotes/1', {
method: 'PUT',
body: JSON.stringify(updatedQuote)
})
.then(response => response.json())
.then(data => console.log('Updated Quote:', data))
.catch(error => console.error('Error:', error));
Update a Single item (PATCH request)
The PATCH request will only update the specified fields, leaving the other fields of the resource unchanged.
const patchedSkyscraper = {
subtitle: "One WTC"
};
fetch('https://timeloopsapi.com/skyscrapers/4', {
method: 'PATCH',
body: JSON.stringify(patchedSkyscraper)
})
.then(response => response.json())
.then(data => console.log('Updated Skyscraper:', data))
.catch(error => console.error('Error:', error));