A simple RESTFul API built with Laravel to manage trips
GET
/airports/list
Example:curl -i -X GET '<REST SERVICE IP>:8080/airports/list?pretty'
GET
/trips/list
Example:curl -i -X GET '<REST SERVICE IP>:8080/trips/list?pretty'
GET
/trips/{trip_id}/flights
Param Name | Description |
---|---|
trip_id |
The trip's id. |
Example: curl -i -X GET '<REST SERVICE IP>:8080/trips/1/flights?pretty' |
POST
/trips?name={name}
Param Name | Description |
---|---|
name |
(Optional) The new trips name. |
Example: curl -i -X POST '<REST SERVICE IP>:8080/trips?pretty' -d 'name=Im making a trip!' |
PUT
/trips/{trip_id}/?name={name}
Param Name | Description |
---|---|
trip_id |
The trip's id. |
name |
The trip's new name. |
Example: curl -i -X PUT '<REST SERVICE IP>:8080/trips/1?pretty' -d 'name=My Cool New Name' |
DELETE
/trips/{trip_id}/flight/{flight_id}
Param Name | Description |
---|---|
trip_id |
The trip id. |
flight_id |
The flight id associate to the trip. |
Example: curl -i -X DELETE '<REST SERVICE IP>:8080/trips/1/flights/1?pretty' |
POST
/trips/{trip_id}/flights/{origin_id}/{destination_id}
Param Name | Description |
---|---|
trip_id |
The trip's id. |
origin_id |
The origin airport id. |
destination_id |
The destination airport id. |
Example: curl -i -X POST '<REST SERVICE IP>:8080/trips/1/flights/6/5?pretty' |
DELETE
/trips/{trip_id}
Param Name | Description |
---|---|
trip_id |
The trip's id. |
Example: curl -i -X DELETE '<REST SERVICE IP>:8080/trips/1?pretty' |
From your terminal, execute the following commands:
git clone https://github.com/aviaialon/FlightHubTripBuilderApi.git
cd FlightHubTripBuilderApi
composer install
- edit
/app/config/database.php
to add the database connection info. php artisan migrate
php artisan db:seed
php artisan serve --port 8080
The service should then be running and ready for use.
TESTS!!! - These should have been done BEFORE writing a single line of code, but because of lack of time.. (not making excuses.. just sayin..)