Author: Geoffrey Prytherch
These services support various RESTFul end points which also includes JSONP support for cross domain requests.
By default the base URL for services is /travel/rest
.
##CREATE
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
{"name": "John Smith", "phoneNumber": "01915552092", "email": "[email protected]"}
- Response example:
- Success: 201 Created
- Validation error: Collection of
<field name>:<error msg>
for each error
{"email":"That email is already used, please use a unique email"}
##READ
- Request type: GET
- Return type: JSON
- Response example:
[{"id": 14, "name": "John Smith", "phoneNumber": "01915552092", "email": "[email protected]"},
{"id": 15, "name": "Jane Smith", "phoneNumber": "01512235655", "email": "[email protected]"}]
- Request type: GET
- Return type: JSON
- Response example:
{"id": 15, "name": "Jane Smith", "phoneNumber": "01512235655", "email": "[email protected]"}
##UPDATE
- Request type: PUT
- Return type: JSON
- Response example:
{"id": 15, "name": "Jane Smith", "phoneNumber": "01512235655", "email": "[email protected]"}
##CREATE
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
{"name":"MGM Grand","postcode":"SW4 5AX","phoneNumber":"02074450192"}
- Response example:
- Success: 201 Created
- Validation error: Collection of
<field name>:<error msg>
for each error
{"phoneNumber":"That phone number is already used, please use a unique phone number"}
##READ
- Request type: GET
- Return type: JSON
- Response example:
[{"id":27,"name":"MGM Grand","postcode":"SW4 5AX","phoneNumber":"02074450192"},{"id":99,"name":"Marriot Liverpool","postcode":"L1 9AZ","phoneNumber":"01916662903"}]
- Request type: GET
- Return type: JSON
- Response example:
{"id":99,"name":"Marriot Liverpool","postcode":"L1 9AZ","phoneNumber":"01916662903"}
##UPDATE
- Request type: PUT
- Return type: JSON
- Response example:
{"id":99,"name":"Marriot Liverpool","postcode":"L1 9AZ","phoneNumber":"01916662903"}
##CREATE
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
{"customer":{"id":10001},"hotel":{"id":1027},"bookingDate":"2015-10-20"}
- Response example:
- Success: 201 Created
- Validation error: Collection of
<field name>:<error msg>
for each error
{"HotelID/Date":"That Hotel and Date combination is already used, please use a unique combination"}
##READ
- Request type: GET
- Return type: JSON
- Response example:
[{"id":1001,"customer":{"id":10001,"name":"John Smith","email":"[email protected]","phoneNumber":"(212) 555-1212"},"hotel":{"id":1027,"name":"MGM Grand","postcode":"SW4 5AX","phoneNumber":"02074450192"},"bookingDate":"2015-10-20"},{"id":1002,"customer":{"id":10002,"name":"Davey Jones","email":"[email protected]","phoneNumber":"(212) 555-3333"},"hotel":{"id":1099,"name":"Marriot Liverpool","postcode":"L1 9AZ","phoneNumber":"01916662903"},"bookingDate":"2015-10-20"},{"id":1003,"customer":{"id":10002,"name":"Davey Jones","email":"[email protected]","phoneNumber":"(212) 555-3333"},"hotel":{"id":1099,"name":"Marriot Liverpool","postcode":"L1 9AZ","phoneNumber":"01916662903"},"bookingDate":"2015-10-21"}]
- Request type: GET
- Return type: JSON
- Response example:
{"id":1001,"customer":{"id":10001,"name":"John Smith","email":"[email protected]","phoneNumber":"(212) 555-1212"},"hotel":{"id":1027,"name":"MGM Grand","postcode":"SW4 5AX","phoneNumber":"02074450192"},"bookingDate":"2015-10-20"}
##UPDATE
- Request type: PUT
- Return type: JSON
- Response example:
{"id":1001,"customer":{"id":10001,"name":"John Smith","email":"[email protected]","phoneNumber":"(212) 555-1212"},"hotel":{"id":1027,"name":"MGM Grand","postcode":"SW4 5AX","phoneNumber":"02074450192"},"bookingDate":"2015-10-20"}
##DELETE
- Request type: DELETE
- Return type: JSON
- Response example:
{}
##CREATE
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
{"id":501,"customer":{"id":10002},"flightBookingId":49,"hotelBookingId":5,"taxiBookingId":2}
- Response example:
- Success: 201 Created
- Validation error: Collection of
<field name>:<error msg>
for each error
{"error":"Failed to create a hotel booking"}
##READ
- Request type: GET
- Return type: JSON
- Response example:
[{"id":501,"customer":{"id":10002,"name":"Davey Jones","email":"[email protected]","phoneNumber":"(212) 555-3333"},"flightBookingId":49,"hotelBookingId":5,"taxiBookingId":2}]
##DELETE
- Request type: DELETE
- Return type: JSON
- Response example:
{}
##READ
- Request type: GET
- Return type: JSON
- Response example:
[{"id":10001,"departurePoint":"DUB","flightNumber":"12345","destinationPoint":"NCL"},{"id":10000,"departurePoint":"VLN","flightNumber":"ABCDE","destinationPoint":"NCL"}]
- Request type: GET
- Return type: JSON
- Response example:
{"id":10001,"departurePoint":"DUB","flightNumber":"12345","destinationPoint":"NCL"}
##READ
- Request type: GET
- Return type: JSON
- Response example:
[{"id":100,"regNumber":"NCLUNI1","numOfSeats":"5"},{"id":101,"regNumber":"NCLUNI2","numOfSeats":"6"}]
- Request type: GET
- Return type: JSON
- Response example:
{"id":100,"regNumber":"NCLUNI1","numOfSeats":"5"}
##CREATE
- Request type: POST
- Request type: JSON
- Return type: JSON
- Request example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "223-223-1231", birthDate:'1966-01-03'}
- Response example:
- Success: 200 OK
- Validation error: Collection of
<field name>:<error msg>
for each error
{"email":"That email is already used, please use a unique email"}
##READ
- Request type: GET
- Return type: JSON
- Response example:
[{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "223-223-1231", birthDate:'1966-01-03'},
{email: "[email protected]", id: 15, firstName: "John", lastName: 'Doe', phoneNumber: "212-555-1212", birthDate:'1978-02-23'}]
- Request type: GET
- Return type: JSON
- Response example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "223-223-1231", birthDate:'1966-01-03'}
##UPDATE
- Request type: PUT
- Return type: JSON
- Response example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "223-223-1231", birthDate:'1966-01-03'}
##DELETE
- Request type: DELETE
- Return type: JSON
- Response example:
{email: "[email protected]", id: 14, firstName: "Jane", lastName: 'Doe', phoneNumber: "223-223-1231", birthDate:'1966-01-03'}