This document contains descritpions, instructions, and some examples for a Java Springboot and MySQL based Web API service that handles the back-end logic of buying, selling, product exploration, and user management functionalities for an online store.
For manual installation, the following packages have to be present in the installation environment:
- Java 11 SDK
- Springboot version 2.2.6.RELEASE
- MySQL 5.7 (or higher)
- Java MySQL Connector
For automatic installation, refer to the pom.xml file in this repo, or to the Docker installation section in this document.
- The API consists of a set of public functions.
- A function can be accessed via an HTTP request using a unique URL.
- The parameters of a function are passed as URL parameters or in the body of the HTTP request in JSON format.
POST
/<user_type>/register
e.g. /buyer/register
{
"username": <username>,
"email": <email>,
"password": <password>,
"name": <name>,
additional: <additional_information>
}
Verifies that the given credentials meet the following criteria:
- None of the required parameters is null or empty
- The username, email, and password lengths are within a predefined range
- The given email string is a valid email
- The username and the email are not already existent in the database
If the criteria is met, these credentials are mapped to the database.
Possible (but not all) status responses:
- Error: Username already exists
- Error: e-mail already exists
- Error: username cannot be empty and must be between 5 and 16 characters
- Error: Unhandled Exception
- OK
{
"username": "user1",
"email": "[email protected]",
"password": "1234",
"name": "my_name",
"socialID": "ID123"
}
GET
/admin/list_all
This function requires no body.
Fetches all registered users from the database and returns them in a list.
{
[{user1}, {user2}, ....]
}
{
[
{
"username": "user1",
"email": "[email protected]",
"password": "1234",
"name": "my_name",
"socialID": "ID_YYY"
},
{
"username": "user2",
"email": "[email protected]",
"password": "12345",
"name": "my_name",
}
]
}