This repository contains the source code for a robust Java Spring Boot application built to fulfill the requirements of Task 1 of the Kaiburr assessment. The application exposes a RESTful API for managing "task" objects, which represent shell commands. It supports full CRUD (Create, Read, Update, Delete) operations, as well as advanced search and execution capabilities. All data is persisted in a MongoDB database.
The project is built with a focus on clean code, adherence to REST principles, and clear documentation.
- Task Management: Full lifecycle management of task objects.
- Database Integration: Seamlessly stores and retrieves data from a MongoDB database.
- Search Functionality: Endpoint to find tasks based on a partial or full name match.
- Command Execution: An endpoint to trigger the shell command associated with a task and record the execution details, including start/end times and output.
To build and run this application locally, you will need the following software installed:
- Java 17 or later
- Apache Maven
- Docker (for running the required MongoDB instance)
- An API Client (e.g., Postman) for testing the endpoints.
Open your terminal and clone the project from GitHub:
git clone [https://github.com/m-navaneeth8770/kaiburr-java-api-task.git](https://github.com/m-navaneeth8770/kaiburr-java-api-task.git)
cd kaiburr-java-api-taskThis project requires a running MongoDB instance. The easiest way to start one is by using the official Docker image:
docker run -d --name kaiburr-mongo -p 27017:27017 mongoUse the included Maven wrapper to compile and run the Spring Boot application:
mvn spring-boot:runThe API server will start on http://localhost:8080, and it will automatically connect to the MongoDB container.
The following section provides a comprehensive walkthrough of the API's functionality. Each screenshot demonstrates a successful request and response cycle, verifying that all requirements of the assessment have been met. Each screenshot includes my name and the system timestamp to ensure authenticity.
A PUT request to the /tasks endpoint successfully creates a new task object, returning a 201 Created status and the newly created resource.
A GET request to the base /tasks endpoint returns a JSON array containing all tasks currently stored in the database.
A GET request with an id query parameter (/tasks?id=...) correctly fetches and returns the specific task object.
A GET request to /tasks/findByName with a name parameter successfully finds and returns all tasks whose names contain the specified string.
A PUT request to the /tasks/{id}/executions endpoint triggers the task's command. The system records the startTime, endTime, and the command's output, saving it back to the task object.
A DELETE request to /tasks/{id} successfully removes the specified task from the database and returns a confirmation message.
To confirm the DELETE operation was successful, a final GET request is made to /tasks. The API correctly returns an empty array, verifying that the task was permanently removed from the database.






