This is a simple Spring Boot REST API application that allows you to manage entities. The API provides endpoints to create, read, update, and delete entities, as well as a health check endpoint.
- Java 8 or higher
- Maven 3.6.0 or higher
-
Clone the repository:
git clone https://github.com/Sandy-7061/Rest_Api.git
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
Alternatively, you can build a JAR file and run it:
mvn clean package
java -jar target/rest-api-application-0.0.1-SNAPSHOT.jar
After running the application, the API will be accessible at http://localhost:8080
.
-
Get all entities
GET /entity
- Description: Retrieves all entities.
- Response: A list of all entities.
-
Create a new entity
POST /entity
- Description: Creates a new entity.
- Request Body: JSON object representing the entity.
- Response:
true
if the entity is created successfully.
-
Get an entity by ID
GET /entity/id/{myid}
- Description: Retrieves an entity by its ID.
- Path Variable:
myid
(Long) - The ID of the entity. - Response: The entity object.
-
Update an entity by ID
PUT /entity/id/{id}
- Description: Updates an existing entity by its ID.
- Path Variable:
id
(Long) - The ID of the entity to be updated. - Request Body: JSON object representing the updated entity.
- Response: The updated entity object.
-
Delete an entity by ID
DELETE /entity/id/{myid}
- Description: Deletes an entity by its ID.
- Path Variable:
myid
(Long) - The ID of the entity to be deleted. - Response: The deleted entity object.
- Health Check
GET /healthcheck
- Description: Checks the health of the application.
- Response:
Ok
if the application is running properly.
The Entity
class has the following attributes:
id
(String): The ID of the entity.title
(String): The title of the entity.name
(String): The name of the entity.
Example JSON for an Entity:
{
"id": "1",
"title": "Sample Title",
"name": "Sample Name"
}
This project is licensed under the MIT License. See the LICENSE file for details.
You can customize the README further based on your project's specific details, like the repository URL and any additional setup steps.