-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
executable file
·41 lines (32 loc) · 1.77 KB
/
README
File metadata and controls
executable file
·41 lines (32 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Here is an example to test RESTfull web service (limited value to be posted - soon will be full vector) - need to re-map accordingly Reads in the controller
# to run app :
Roses-MacBook-Air:AdvertONE roseair$ ./activator run
[info] Loading project definition from /Applications/advertONE/project
[info] Set current project to scala-play-rest-example (in build file:/Applications/advertONE/)
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
#testing web service:
curl -X POST http://localhost:9000/adverts -H "Content-Type: application/json" -d "{\"title\": \"Jaguar XT\"}"
curl -X GET http://localhost:9000/adverts/1
curl -H "Content-Type: application/json" -X PUT http://localhost:9000/adverts/1 -d "{\"title\": \"Fiat125\"}"
curl -X DELETE http://localhost:9000/adverts/1
#example:
#<POSTING JAGUAR>
curl -X POST http://localhost:9000/adverts -H "Content-Type: application/json" -d "{\"title\": \"Jaguar XT\", \"fuel\": \"GAS\", \"price\": \"125000\", \"issnew\": \"YES\"}"
landing in ADVERT REPOSITORY
created Advert: Advert(Some(1),Jaguar XT)
POST done
#<CHECK WHAT WAS POSTED>
curl -X GET http://localhost:9000/adverts/1
{"id":1,"title":"Jaguar XT"}Roses-MacBook-Air:Applications roseair$
<CHANGE THE CARS>
curl -H "Content-Type: application/json" -X PUT http://localhost:9000/adverts/1 -d "{\"title\": \"Fiat125\", \"fuel\": \"GAS\", \"price\": \"125000\", \"issnew\": \"YES\"}"
#<CHANGED JAGUAR TO FIAT>
curl -X GET http://localhost:9000/adverts/1
{"id":1,"title":"Fiat125"}
#<DELETING id=1>
curl -X DELETE http://localhost:9000/adverts/1
#<CHECK IF EMPTY>
curl -X GET http://localhost:9000/adverts/1
<YES>