Installation manual - Pacek99/faersREST GitHub Wiki
Installation manual for project fearsREST:
System requirements:
- have Apache Tomcat server in your computer
- have access to the internet
Link to Github project:
Comment: To run this part of the project u firstly need to have already created database via an import project from colleague G. Mohňanský, link to his project: https://github.com/mohnanskygabriel/faersDb
Steps:
1.Download this Maven project.
2.In project directory find file DaoFactory.java, open it and in the class constructor rewrite absolute path to file config.txt to your actual absolute path. Then in project directory find file config.txt, open it and in the first line rewrite "sql" to your actual password to database and save file.
3.Open the command line in the project directory and use command: mvn package
4.In the target folder, find the faersREST.war file and move it into webapps folder in your Apache Tomcat server directory.
5.Open the command line in the /bin directory of your Apache Tomcat server.
6.Start Apache Tomcat via Command Line. E.g. in Windows with command: catalina.bat start
After executing all steps we can verify if the app is working by entering "localhost:8080/faersREST/" to browser. It should display page with information text "Application faersREST is working!".
You can verify the functionality of REST service requests via Postman or normally in browser.
Syntax of requests:
notice: in any request containing BRAND_NAME, SUBSTANCE_NAME or MANUFACTURER_NAME, in case that this argument consists of more than one word (or subword) separated by space character " ", then in request url you have to replace those space characters with "%20"
- to find brand name by part of the name of the drug: GET http://localhost:8080/faersREST/webapi/brandnames/BRAND_NAME
- to find brand name by part of the name of active substance name of the drug: GET http://localhost:8080/faersREST/webapi/substancename/SUBSTANCE_NAME
- to find brand name by part of the manufacturer name of the drug: GET http://localhost:8080/faersREST/webapi/manufacturername/MANUFACTURER_NAME
- to filter drugs together by part of the name of the drug, part of the name of active substance name of the drug and part of the manufacturer name of the drug: GET http://localhost:8080/faersREST/webapi/filter/BRAND_NAME/SUBSTANCE_NAME/MANUFACTURER_NAME notice: in case any of parameters is empty just insert "0" as parameter value for example: http://localhost:8080/faersREST/webapi/filter/0/SUBSTANCE_NAME/0
- to find side effects of the specific drug by it's brand name: GET http://localhost:8080/faersREST/webapi/sideeffects/BRAND_NAME
- to find side effects of the specific drug by it's brand name and from specified date: GET http://localhost:8080/faersREST/webapi/sideeffects/BRAND_NAME/DATE //date must be in format YYYYMMDD
- to chceck if given user is already registered: GET http://localhost:8080/faersREST/webapi/register/LOGIN notice: returns value=1 if user is registered and value=0 if not
- to register new user: POST http://localhost:8080/faersREST/webapi/register and HTTP request body should be like: { "login": "LOGIN", "mail": "MAIL", "pass": "PASS" }
- to log in by entering user login and password: POST http://localhost:8080/faersREST/webapi/login and HTTP request body should be like: { "login": "LOGIN", "pass": "PASS" } and result in raw format should be either string "True" if password is correct and "False" if it´s incorrect
- to add preferred drug of given user to database: PUT http://localhost:8080/faersREST/webapi/preferreddrugs/USER_LOGIN/BRAND_NAME
- to delete preferred drug of given user from database: DELETE http://localhost:8080/faersREST/webapi/preferreddrugs/USER_LOGIN/BRAND_NAME
- to get list of preferred drugs of given user from database: GET http://localhost:8080/faersREST/webapi/preferreddrugs/USER_LOGIN
- to test connection between REST and database: GET http://localhost:8080/faersREST/webapi/testmodules returns True if connection is working / False if not