This is our EPSI project. It consists of an application made with Ionic 2 which can interract with the webservice.
The idea is simple, organize a trip with your friend and split the spending.
You need all these softwares in order to edit the current project.
- NeatBeans 8.2 (EE edition)
- JavaEE 7 with JDK 8
- GlassFish 4.1
- MySQL 5.7
- Postman (optional)
- A good web browser like Chromium
If you just want to install it in a production way.
- GlassFish 4.1
- MySQL 5.7
git clone https://github.com/Dinath/workshop-i5
Tests are auto-generated by the Application.java
. Just comment the test()
method to end it, then re-deploy the project.
Database is recreated on each deployment throught persistence.xml.
You just need to deploy the project through GlassFish or use Netbeans.
Returns 200 if it is OK, 400 otherwise.
On creation / connection, return the whole JSON entity.
Two routes are available.
http://localhost:8080/WorkshopI5/ws/trip/
http://localhost:8080/WorkshopI5/ws/user/
### GET
Optional : use and ID to get a specified user.
http://localhost:8080/WorkshopI5/ws/user/{id}
[
{
"email": "root@root.org",
"name": "root",
"first-name": "root",
"password": "H\u0013IM\u0013~\u00161��\u0001լ�n{��t�\u0011��VV^�\u001dsvw�",
"date-creation": "2016-11-17",
"phone-number": "06-07-88-99-14",
"date-birthday": "2016-11-17"
}
]
### DELETE
Optional : Delete an entity.
http://localhost:8080/WorkshopI5/ws/user/{id}
Returns the JSON code for entity or 404 not found.
### GET by ID
Optional : use and ID to get a specified user.
http://localhost:8080/WorkshopI5/ws/user/{id}
Returns the JSON code for entity or 404 not found.
### POST
http://localhost:8080/WorkshopI5/ws/user
{
"date-birthday": "2016-10-19",
"email": "alex@root-8.org",
"first-name": "alex",
"name": "alex",
"password": "root",
"phone-number": "06-07-88-99-14"
}
Returns 405 code if the mail address is already used.
The POST
returns the same JSON with its ID.
Only needs ID for User fields.
http://localhost:8080/WorkshopI5/ws/trip
For PUT, add the Trip ID.
{
"address-from": "Odyseum, Montpellier",
"address-to": "Gare du Nord, Paris",
"date-creation": "2016-11-17",
"date-from": null,
"date-to": null,
"description": "Description...",
"name": "davy trip",
"number-insiders": 2,
"number-participers": 10,
"price": 20,
"user-organizer": {
"id": 1
},
"users-participer": [
{
"id": 1
}
]
}
### PUT
DO NOT FORGET TO PUT THE ID.
http://localhost:8080/WorkshopI5/ws/user
{
"id": 6,
"date-birthday": "2016-11-17",
"date-creation": "2016-11-17",
"email": "alex@root-8.org",
"first-name": "alex",
"name": "alex",
"phone-number": "06-07-88-99-14"
}
We can GET / POST on custom routes.
Ordered by higher price.
http://localhost:8080/WorkshopI5/ws/trip/order-price/0
Ordered by lower price.
http://localhost:8080/WorkshopI5/ws/trip/order-price/1
GET
it from this URL, simple TEXT.
http://localhost:8080/WorkshopI5/ws/trip/best-price/1
http://localhost:8080/WorkshopI5/ws/trip/best-price/0
POST
the JSON code on.
http://localhost:8080/WorkshopI5/ws/trip/with-params
{
"place": "Paris",
"dateFrom": "2016-11-17",
"priceMin": 20,
"priceMax": 25
}
POST
a JSON code on the followin URL with proper informations : based on the destination date.
http://localhost:8080/WorkshopI5/ws/trip/available
{
"address-to": "Paris",
"date-to": "2016-11-17"
}
POST
a JSON code with proper informations.
{
"email": "root@root.org",
"password": "root"
}
If the user exists, then the whole user entity will be returned.
If the user does not exist, there will be a 404 Response
.