The Aquascript Book API is a lightweight JSON-based RESTful API that provides metadata for books, including author, country of origin, language, page count, and more.
The base URL to fetch the books data is:
https://wecoded-dev.github.io/Aquascript/api/books.json
Each book object follows this format:
{
"author": "Chinua Achebe",
"country": "Nigeria",
"imageLink": "assets/ThingsFallApart.jpg",
"language": "English",
"link": "https://en.wikipedia.org/wiki/Things_Fall_Apart",
"pages": 209,
"title": "Things Fall Apart",
"year": 1958
}
Fetch data using JavaScript’s fetch()
API:
fetch('https://wecoded-dev.github.io/Aquascript/api/books.json')
.then(response => response.json())
.then(data => {
console.log(data); // View book data
});
HTML placeholder for books:
<div id="book-list"></div>
JavaScript example to populate the book list:
document.addEventListener('DOMContentLoaded', () => {
const bookList = document.getElementById('book-list');
fetch('https://wecoded-dev.github.io/Aquascript/api/books.json')
.then(response => response.json())
.then(data => {
data.forEach(book => {
const bookCard = document.createElement('div');
bookCard.innerHTML = `
<h3>${book.title} (${book.year})</h3>
<p><strong>Author:</strong> ${book.author}</p>
<p><strong>Country:</strong> ${book.country}</p>
<p><strong>Language:</strong> ${book.language}</p>
<p><strong>Pages:</strong> ${book.pages}</p>
<img src="${book.imageLink}" alt="${book.title}" width="120">
`;
bookList.appendChild(bookCard);
});
})
.catch(error => console.error('Error loading books:', error));
});
The Aquascript Book API empowers developers to integrate rich book data into their projects. Whether you're building a reading app, digital library, or educational tool, this API provides the structure and accessibility to get started quickly.