Book Store Api

A free fake and reliable book store API for testing and prototyping

Try It

Run this code here, in the web browser's console or from any site and then view the results

fetch('https://bookstore-api-six.vercel.app/api/books')
.then(response => response.json())
.then(json => console.log(json))

When to use

This book store api is a free online REST API that you can use whenever you need some fake data from a book store. It can be for a Front End project, a code demo needed, or to test how dynamic data will load on your application

Resources

This API comes with 1 resource

Routes

All HTTP methods are supported. You can use the following routes for your requests.

Guide

Take a look at the examples below using the Fetch API, but this API can be accessed using other languages and libraries.

Getting all Books

fetch('https://bookstore-api-six.vercel.app/api/books')
.then(response => response.json())
.then(json => console.log(json))

Output Below:

[
{
id: 1,
title: '...',
author: '...',
isbn: '...',
publishedDate: '...',
publisher: '...',
genre: '...',
description: '...',
pageCount: 896,
language: '...',
createdAt: '...',
updatedAt: '...'
}
...rest of the books
]

Getting a Book

fetch('https://bookstore-api-six.vercel.app/api/books/1')
.then(response => response.json())
.then(json => console.log(json))

Output Below:

{
id: 1,
title: '...',
author: '...',
isbn: '...',
publishedDate: '...',
publisher: '...',
genre: '...',
description: '...',
pageCount: 896,
language: '...',
createdAt: '...',
updatedAt: '...'
}

Creating a New Book

fetch('https://bookstore-api-six.vercel.app/api/books', {
method: 'POST',
body: JSON.stringify({
title: 'New Book',
author: 'New Author',
isbn: 'New ISBN',
}),
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(json => console.log(json))

Output Below:

{
id: 101,
title: 'New Book',
author: 'New Author',
isbn: 'New ISBN',
}

Updating an Existing Book

fetch('https://bookstore-api-six.vercel.app/api/books/1', {
method: 'PUT',
body: JSON.stringify({
title: 'New Title',
}),
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(json => console.log(json))

Output Below:

{
id: 1,
title: 'New Title',
}

Deleting an Existing Book

fetch('https://bookstore-api-six.vercel.app/api/books/1', {
method: 'DELETE'
})
.then(response => response.json())
.then(json => console.log(json))

Output Below:

{
id: 1,
message: 'Book deleted',
}

Limiting the Amount of Books you Fetch

fetch('https://bookstore-api-six.vercel.app/api/books?amount=30')
.then(response => response.json())
.then(json => console.log(json))

Output Below:

[
{
id: 1,
title: '...',
author: '...',
isbn: '...',
publishedDate: '...',
publisher: '...',
genre: '...',
description: '...',
pageCount: 896,
language: '...',
createdAt: '...',
updatedAt: '...'
}
...rest of the books
]