This is a simple REST API that calculates the frequency of characters in a given input string and returns the result in JSON format. The result is sorted in descending order of character frequencies.
- Java 8+
- Spring Boot 2+
- Gradle (for building)
-
Clone this repository to your local machine:
git clone https://github.com/firapinch/test-CharacterFrequency-REST_api.git
-
Build the project:
cd test-CharacterFrequency-REST_api gradle build
-
Run the application:
java -jar build/libs/test-CharacterFrequency-REST_api-0.0.1-SNAPSHOT.jar
-
The application will start on http://localhost:8080.
To calculate the character frequency, make a GET request to the following endpoint:
http://localhost:8080/calculate-frequency?input=<your_input_string>
If you want to integrate this API into a real project, follow these steps:
-
Host the API: Deploy the API on a remote server or cloud hosting service of your choice.
-
Access the API: Once the API is deployed, you can access it using its public URL. Replace
<api-url>
with the actual URL of your deployed API in the examples below. -
Make HTTP Requests: Use HTTP client libraries or tools in your preferred programming language to make HTTP requests to the API. You can send a GET request to calculate character frequency.
-
Example Request:
GET http://<api-url>/calculate-frequency?input=your_input_string
Replace
<api-url>
with your API's URL andyour_input_string
with the string for which you want to calculate character frequency. -
-
Receive JSON Response: The API will respond with a JSON object containing character frequencies sorted in descending order.
-
Example Response:
{ "a": 5, "c": 4, "b": 1 }
-
Remember to provide the actual URL of your deployed API and any additional authentication or authorization details if necessary in your project's documentation.
This project is licensed under the MIT License. See the LICENSE file for details.