Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danijeldragicevic/compress-decompress-jsons-rest-service
Service who is able to compress or decompress JSON files.
https://github.com/danijeldragicevic/compress-decompress-jsons-rest-service
mule4 raml zip
Last synced: 6 days ago
JSON representation
Service who is able to compress or decompress JSON files.
- Host: GitHub
- URL: https://github.com/danijeldragicevic/compress-decompress-jsons-rest-service
- Owner: danijeldragicevic
- License: apache-2.0
- Created: 2023-02-15T13:37:10.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-14T23:15:20.000Z (almost 2 years ago)
- Last Synced: 2024-11-07T10:35:52.767Z (about 2 months ago)
- Topics: mule4, raml, zip
- Language: RAML
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Compress/Decompress JSON files REST service
Mule4 example app. Able to receive and produce compressed files.Service is able to:
- receive plain JSON data, compress it to ZIP format and store in local file;
- receive zipped JSON data, decompress it and store in local file.# Technology
- RAML 1.0
- Mule 4.4.0EE# To run application:
Checkout from this repository and import into Anypoint Studio 7.X.X.# Exposed endpoints:
By default, service will run on **http://localhost:8081**
Following endpoints will be exposed:
| Methods | Urls | Action |
|---------|-----------------|---------------------------------------------------------|
| GET | /console | Gives access to the generated documentation for the API |
| POST | /api/compress | Compress payload and store to the local directory |
| POST | /api/decompress | Decompress payload and store to the local dir |# Examples
**Example 1:** GET http://localhost:8081/console/
Run in browser or REST client tool (e.g. Insomnia, Postman...) to open generated documentation for the API.
It gives opportunity to interact with the API by setting the expected Contetn-Type and payload.![Screenshot 2023-02-16 at 11 51 07](https://user-images.githubusercontent.com/82412662/219344995-4ad77936-1ae7-4d62-b8a4-6dace286826f.png)
**Example 2:** POST http://localhost:8081/api/compress
Setting of Content-Type is mandatory. In this case we have to set it to the "application/json" type.
Request body:
```
[
{
"firstName": "Jane",
"lastName": "Doe"
},
{
"firstName": "Judy",
"lastName": "Doe"
},
{
"firstName": "John",
"lastName": "Doe"
},
{
"firstName": "James",
"lastName": "Doe"
}
]
```
Response: 200 OK.
Response body:
```
{
"message": "Successfully processed"
}
```
As result, compressed file with the payload content will be created on the "src/main/resources/output" path.**Example 2:** POST http://localhost:8081/api/decompress
Setting of Content-Type is mandatory. In this case we have to set it to the "application/zip" type.
To place compressed file in the payload it is most convenient to use some REST client tool.Response: 200 OK.
Response body:
```
{
"message": "Successfully processed"
}
```
As result, decompressed file with the payload content will be created on the "src/main/resources/output" path.# Licence
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)