From 9167b135f5b02b433306718e8d01e53cb60b2f05 Mon Sep 17 00:00:00 2001 From: GME Date: Mon, 8 Apr 2019 21:07:02 +0200 Subject: [PATCH] Update user api --- postman/JAVA-API.postman_collection.json | 387 -------------------- src/main/java/restService/UserResource.java | 2 +- 2 files changed, 1 insertion(+), 388 deletions(-) delete mode 100644 postman/JAVA-API.postman_collection.json diff --git a/postman/JAVA-API.postman_collection.json b/postman/JAVA-API.postman_collection.json deleted file mode 100644 index 134a3f2..0000000 --- a/postman/JAVA-API.postman_collection.json +++ /dev/null @@ -1,387 +0,0 @@ -{ - "info": { - "_postman_id": "6f868823-1ce1-4139-ba21-60eca129d008", - "name": "JAVA-API", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Transaction", - "item": [ - { - "name": "getTransaction", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://localhost:8083/api/rest/transaction/get?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG&transactionHash=TESTGFJDOOJI3285941981FDSDSFSSDGxxdsfz", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "transaction", - "get" - ], - "query": [ - { - "key": "userHash", - "value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG" - }, - { - "key": "transactionHash", - "value": "TESTGFJDOOJI3285941981FDSDSFSSDGxxdsfz" - } - ] - } - }, - "response": [] - }, - { - "name": "getLatestTransaction", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://localhost:8083/api/rest/transaction/getLatest?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "transaction", - "getLatest" - ], - "query": [ - { - "key": "userHash", - "value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG" - } - ] - } - }, - "response": [] - }, - { - "name": "getAllTransaction", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://localhost:8083/api/rest/transaction/getAll?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "transaction", - "getAll" - ], - "query": [ - { - "key": "userHash", - "value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG" - } - ] - } - }, - "response": [] - }, - { - "name": "saveTransaction", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n\t\"transactionFrom\":\"$2a$10$jviPGl4mc1nGOp4hZUyOmeFqFWlQB7mvFToWPGUiq8W5Z1LZP3e4C\",\r\n\t\"transactionTo\":\"$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG\",\r\n\t\"transactionHash\":\"TESTGFJDOOJI3285941981FDSDSFSSDGxxdsfz\",\r\n\t\"transactionAmount\":1.50,\r\n\t\"transactionUnit\":\"Gonettes\"\r\n}" - }, - "url": { - "raw": "http://localhost:8083/api/rest/transaction/save", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "transaction", - "save" - ] - } - }, - "response": [] - }, - { - "name": "sentTransactions", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://localhost:8083/api/rest/transaction/sent?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "transaction", - "sent" - ], - "query": [ - { - "key": "userHash", - "value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG" - } - ] - } - }, - "response": [] - }, - { - "name": "receivedTransaction", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://localhost:8083/api/rest/transaction/received?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "transaction", - "received" - ], - "query": [ - { - "key": "userHash", - "value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "Server", - "item": [ - { - "name": "get sent transactions", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://37.187.101.44:10053/api/rest/transaction/sent?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG", - "protocol": "http", - "host": [ - "37", - "187", - "101", - "44" - ], - "port": "10053", - "path": [ - "api", - "rest", - "transaction", - "sent" - ], - "query": [ - { - "key": "userHash", - "value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG" - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "FirstTest", - "item": [ - { - "name": "getBalance", - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://localhost:10053/api/rest/query/balance?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "10053", - "path": [ - "api", - "rest", - "query", - "balance" - ], - "query": [ - { - "key": "userHash", - "value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG" - } - ] - } - }, - "response": [] - }, - { - "name": "Login", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"email\":\"thomas.marshal@gmal.com\",\n\t\"password\":\"newPassword\"\n}" - }, - "url": { - "raw": "http://localhost:10053/api/rest/user/login", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "10053", - "path": [ - "api", - "rest", - "user", - "login" - ] - } - }, - "response": [] - }, - { - "name": "Register", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"name\":\"Clara\",\n\t\"firstname\":\"Sophie\",\n\t\"email\":\"sophie.clara@gmail.com\",\n\t\"password\":\"sophieClara\"\n}" - }, - "url": { - "raw": "http://localhost:8083/api/rest/user/save", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "user", - "save" - ] - } - }, - "response": [] - }, - { - "name": "getUser", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "name": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\n\t\"email\":\"thomas.marshal@gmail.com\",\n\t\"password\":\"newPassword\"\n}" - }, - "url": { - "raw": "http://localhost:8083/api/rest/user/get", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "8083", - "path": [ - "api", - "rest", - "user", - "get" - ] - } - }, - "response": [] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/java/restService/UserResource.java b/src/main/java/restService/UserResource.java index 462e656..7fdbb55 100644 --- a/src/main/java/restService/UserResource.java +++ b/src/main/java/restService/UserResource.java @@ -110,7 +110,7 @@ public class UserResource { userResponse.setUserId(response.getUserId()); return ResponseEntity.status(HttpStatus.OK).body(userResponse); }else{ - return new ResponseEntity("Error", HttpStatus.NOT_FOUND); + return new ResponseEntity("{\"response\":\"error\"}", HttpStatus.NOT_FOUND); } }catch (Exception e){ return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);