3 Provides a REST-API to generate PDF reports for terms and their sentiment analysis results. The service uses an .NET Core wrapper for the wkhtmltopdf library to generate pdf out of html code.
5 `GET`: `/` Shows a demo page
9 `POST`: `/generatePDF/` Generates a pdf report for the given terms
10 - Header: `Content-Type`: `application/json`
11 (optional) `Accept`: `application/base64` if the pdf should be in base64 instead of `application/pdf`
12 - Body of request: Term[] e.g.
32 Term(string `Name`, double `Sentiment`)
36 - `docker build -t service-reporting .`
37 - `docker run -p YOUR_PORT:8083 service-reporting:latest`
42 - download [libwkhtml library](https://github.com/rdvojmoc/DinkToPdf/tree/master/v0.12.4) depending on your operating system and put it into `service-reporting` root folder
47 - successfull pdf as application/json: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Content-Type: application/json' \ -d '[ { "name": "A bad term", "sentiment": 0.1 }, { "name": "Another bad term", "sentiment": 0.3 }, { "name": "A neutral term", "sentiment": 0.5 }, { "name": "A good term", "sentiment": 0.65 }, { "name": "Another good term", "sentiment": 0.9 } ] '`
48 - successfull pdf as application/base64: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Accept: application/base64' \ -H 'Content-Type: application/json' \ -d '[ { "name": "A bad term", "sentiment": 0.1 }, { "name": "Another bad term", "sentiment": 0.3 }, { "name": "A neutral term", "sentiment": 0.5 }, { "name": "A good term", "sentiment": 0.65 }, { "name": "Another good term", "sentiment": 0.9 } ] '`
49 - invalid sentiment value: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Content-Type: application/json' \ -d '[ { "name": "Term with invalid sentiment value", "sentiment": 12 } ] '`
50 - invalid json structure: `curl -X POST \ http://localhost:8083/generatePDF \ -H 'Content-Type: application/json' \ -d '[ { "name1": "A term with invalid json format", "sentiment": 0.5 } ] '`