- Description
- Features
- Usage
- How to Create the Database and Tables
- API Endpoints
- Example Inputs
- License
The Orizon API project is a RESTful API designed to manage travel trips and associated countries. It provides CRUD (Create, Read, Update, Delete) operations for trips and countries, allowing users to create, retrieve, update, and delete trip records, as well as manage the countries involved in each trip. The API returns results in the form of JSON.
- Create, Read, Update, and Delete operations for trips and countries.
- Manage countries associated with each trip.
- Filter trips by available seats and countries.
- Simple and intuitive API endpoints.
- Clone the repository.
- Create the database schema:
- Create a MySQL database named
orizon
.
- Create a MySQL database named
- Configure the database connection:
- Open the
config/database.php
file. - Update the database credentials according to your MySQL configuration.
- Open the
- Start the development server (es. start Apache and MySQL on XAMPP)
- You can now access the API endpoints using Postman or any other HTTP client.
- Open your preferred database management tool (e.g., MySQL Workbench, phpMyAdmin).
- Create a new database named
orizon
or any other preferred name. - Run the SQL script
schema.sql
in your database management tool to create the necessary tables for the Orizon API project. - After running the script, you should see three tables created:
countries
,trips
, andtrip_countries
(a JOINT table). - The named tables are the ones considered for the creation of this projects. You can use the provided code as a starting point and then develop your own database personalized API.
- GET /trip/read.php: Retrieve all trips.
- POST /trip/create.php: Create a new trip.
- PUT /trip/update.php: Update an existing trip.
- DELETE /trip/delete.php: Delete a trip.
- GET /country/read.php: Retrieve all countries.
- POST /country/create.php: Create a new country.
- PUT /country/update.php: Update an existing country.
- DELETE /country/delete.php: Delete a country.
(the following were used to test the API on Postman)
{ "available_seats": 100, "countries": ["Italy", "Korea", "Spain"] }
{ "id": 1, "available_seats": 80 }
- input the correct id that you can find using GET /country/read.php: Retrieve all countries.
{ "id": 1 }
Inputs for CRUD operations available for the countries table are similarly very easy and simple to apply.
This project is licensed under the MIT License - see the LICENSE file for details.