Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ullenius/forverkliga-book-database
Book Database API for use as practice by client-side developers. Mocks a poorly designed API with CRUD-functionality. Randomly fails ~80% of operations
https://github.com/ullenius/forverkliga-book-database
book-database gplv3 java maven mock-server rest-api reverse-engineering spring-boot
Last synced: 8 days ago
JSON representation
Book Database API for use as practice by client-side developers. Mocks a poorly designed API with CRUD-functionality. Randomly fails ~80% of operations
- Host: GitHub
- URL: https://github.com/ullenius/forverkliga-book-database
- Owner: ullenius
- License: gpl-3.0
- Created: 2020-09-02T19:32:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T10:51:52.000Z (about 2 years ago)
- Last Synced: 2024-11-08T10:50:40.455Z (2 months ago)
- Topics: book-database, gplv3, java, maven, mock-server, rest-api, reverse-engineering, spring-boot
- Language: Java
- Homepage:
- Size: 107 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# :books: Book Database API Backend
A reverse-engineered Java :coffee: version of the Book Database API.
The [original](https://www.forverkliga.se/JavaScript/api/crud.php) was written
by David Andersson using PHP.This is an intentionally poorly designed API that simulates a Book Database.
Its purpose is for client-side developers to practice working with a flaky and
badly designed API.Databases automatically expire after 30 minutes of non-use.
**This is the server code** For the client-web app
see [book-api-js](https://github.com/ullenius/book-api-js).## :construction_worker: Installation
This is a Maven project.
To build the project run:
~~~sh
./mvnw install
~~~## :pushpin: API Summary
1. The API has a high likelihood of failing. On every operation.
2. The API returns `HTTP 200` on every operation
3. The API accepts only query-parameters.
4. Only `GET` is used.## :information_source: Technical API Documentation
Text by David Andersson.
This API simulates a book database. There are 4 operations available:
1. Add data to database
2. View data in database
3. Modify data in database
4. Delete data## :key: API key
In order to use the database you need an API key. Request a key by an `GET`
request with `requestKey` in the query string. You must use that key in all
subsequent requests.Example: `localhost:8080/?requestKey`
## :blue_book: Add data
Add book information to the database. Query string parameters:
op=insert
key - an API key that identifies the request
title - the book title
author - the name of the authorThis request will output a `JSON` object of the following form if successful:
~~~
{
"status": "success",
"id": an id generated for the inserted data
}
~~~## :eyeglasses: View data
Get all book information in database. Query string parameters:
op=select
key - an API key that identifies the requestThis request will output a `JSON` object of the following form if successful:
~~~
{
"status": "success",
"data": [{
"id": a unique id that identifies a book,
"title": book title,
"author": author name,
"updated": when the data was last updated
}]
}
~~~
## :pencil: Modify dataChange the entry for a specific book. Query string parameters:
op=update
key - an API key that identifies the request
id - identifies what book you want to update
title - new title
author - new authorThis request will output a `JSON` object of the following form if successful:
~~~json
{
"status": "success"
}
~~~
## :skull: Delete dataDelete the information for a specific book in the database. Query string
parameters:op=delete
key - an API key that identifies the request
id - identifies what book you want to removeThis request will output a `JSON` object of the following form if successful:
~~~json
{
"status": "success"
}
~~~
## :poop: ErrorsEvery operation may fail! If an error occurs, the request will output a `JSON`
object that describes the error:
~~~
{
"status": "error",
"message": a descriptive message
}
~~~