This project provides an API for the Sakila database, which is a sample database used for testing and education purposes. The API is available in two styles: Representational State Transfer (REST) and Simple Object Access Protocol (SOAP). It uses JAX-RS and JAX-WS to create the web services, JPA to interact with MySQL database, and Maven to manage the project. It also utilizes Lombok and MapStruct for improved code generation and Tomcat for deployment.
- JAX-RS
- JAX-WS
- JPA
- Maven
- Lombok
- MapStruct
- Tomcat
- Java 11 or higher
- Maven
- Tomcat
- MySQL Server
- Sakila DB
To get started with this project, you will need to clone this repository onto your local machine:
git clone https://github.com/Zyad1999/Sakila-API
- Configure the Sakila-API/src/main/resources/META-INF/persistence.xml file with your DB credentials.
- Configure the tomcat plguin in the Sakila-API/pom.xml file with your tomcat credentials.
To deploy this project run
cd Sakila-API
mvn install tomcat7:deploy
- The REST endpoints can be accessed at http://localhost:9090/sakilaAPI/rest
- The SOAP endpoints can be accessed at http://localhost:9090/sakilaAPI/soap
-
The REST API provides endpoints for CRUD operation at all the resources in addintion to enpoints for the bussines logic.
-
CRUD operations on the resources follow this pattern.
GET /sakilaAPI/rest/entity?limit=1&offset=0
Parameter | Type | Description |
---|---|---|
limit |
int |
Required. Number of entites returned |
offset |
int |
Required. Number of entites skipped |
GET /sakilaAPI/rest/entity/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Required. Id of entity to fetch |
POST /sakilaAPI/rest/entity
Body | Location | Description |
---|---|---|
EntityRequest |
Sakila-API\src\main\java\com\sakilaAPI\service\dtos\requests |
Required. Body of the entity that will be added |
POST /sakilaAPI/rest/entity/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Required. Id of the entity that will be updated |
Body | Location | Description |
---|---|---|
EntityRequest |
Sakila-API\src\main\java\com\sakilaAPI\service\dtos\requests |
Optional. Body of attributes to be updated |
DELETE /sakilaAPI/rest/entity/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Required. Id of entity to delete |
- The SOAP API provides a Web Service for all the entites which containg CRUD operations on the entity and the bussiness logic of the entity if any.
- The services follow this pattern.
Service Name | Port Name | Description |
---|---|---|
EntityService |
EntityPort |
The endpoint of the entity |
Address | WSDL | Implementation class |
---|---|---|
/sakilaAPI/soap/entity |
/sakilaAPI/soap/entity?wsdl |
com.sakilaAPI.api.soap.services.Entity |
Contributions are always welcome! Please feel free to open a pull request or an issue if you would like to contribute to this project.