List Birds Using RESTful API
This project is a simple API built in local environment using XAMPP. This API allows you to manage data such as getting bird information, adding new data, changing data, and deleting data.
- Make sure you have a code editor such as Visual Studio Code installed on your computer.
- Make sure you have installed XAMPP on your computer.
- You can use
XAMPP
to run the project. But I suggest you to useLive Server
extension in Visual Studio Code. - Clone this repository into the
htdocs
directory in theXAMPP
installation folder (make sure the folder name islist-birds-API
eg:C:\xampp\htdocs\list-birds-API
). - Create a new database in phpMyAdmin with the database name
birds-api
- Import the table schema from the
birds-api.sql
file to the database that has been created. - Configure the database connection in the
config.php
file with your MySQL settings details.
- Run XAMPP Control Panel and enable
Apache
andMySQL
- Start the Live Server by typing
Go Live
in the status bar or right-clicking on the HTML Fileindex.html
and clickOpen with Live Server
in the Explorer Window. - Open a browser and access
http://127.0.0.1:5500
to view the application.
Here are some of the endpoints you can access:
- GET
/Birds.php
: Get a list of bird information. - GET
/DBHelper.php?typebird_id=1
: Get detailed bird information based on ID Type Bird. - GET
/Type.php
: Get some data in the Type of Bird table. - GET
/Categories.php
: Get some data in the Categories table. - POST
/AddInfo.php?name_of_bird=Struthio&type_of_bird=1&categories_bird=1&file_path=../uploads/struthio.jpg
: Added new bird information. - POST
/AddType.php?type_of_birds=NewType
: Adds a new data Type. - POST
/EditBirds.php?id=1&name_of_bird=Struthio&type_of_bird=1&categories_bird=1&file_path=../uploads/struthio.jpg
: Edits bird data. - PUT
/EditType.php?id=1&type_of_birds=EditedType
: Changes the Type of Bird data. - DELETE
/DelBirds.php?id=1
: Deletes bird information by ID. - DELETE
/DelType.php?id=1
: Deletes Type of Bird data based on ID.
GET http://localhost/list-birds-API/controller/Birds.php
GET http://localhost/list-birds-API/controller/DBHelper.php?typebird_id=1
GET http://localhost/list-birds-API/controller/Type.php
GET http://localhost/list-birds-API/controller/Categories.php
POST http://localhost/list-birds-API/controller/AddInfo.php?name_of_bird=Struthio&type_of_bird=1&categories_bird=1&file_path=../uploads/struthio.jpg
POST http://localhost/list-birds-API/controller/AddType.php?type_of_birds=NewType
POST http://localhost/list-birds-API/controller/EditBirds.php?id=1&name_of_bird=Struthio&type_of_bird=1&categories_bird=1&file_path=../uploads/struthio.jpg
PUT http://localhost/list-birds-API/controller/EditType.php?id=1&type_of_birds=EditedType
DELETE http://localhost/list-birds-API/controller/DelBirds.php?id=1
DELETE http://localhost/list-birds-API/controller/DelType.php?id=1