ABUTEL API is a RESTful API that allows users to manage telephone directory entries such as names, phone numbers, addresses, and departments. It also supports user authentication using email or username via Laravel Sanctum.
Below is the table of available API endpoints:
| Method | Endpoint | Description |
|---|---|---|
| POST | /login | Authenticate user via email or username |
| POST | /logout | Logout current authenticated user |
| GET | /telephones | Retrieve all telephone directory entries |
| POST | /telephones | Create a new telephone directory entry |
| GET | /telephones/{id} | Retrieve details of a specific entry |
| PUT | /telephones/{id} | Update a specific telephone entry |
| DELETE | /telephones/{id} | Delete a specific telephone entry |
- Login using email or username.
- Manage telephone directory (CRUD operations).
- Authentication is only required for login/logout.
- PHP
- Laravel Framework
- Sanctum for API Authentication
Here are the steps to install and run the project:
- PHP >= 8.1
- Composer
- MySQL or any supported database
1. Clone the repository into a local directory:
git clone https://github.com/ramadhanabelio/abutel-api.git2. Navigate to the project directory:
cd abutel-api3. Install Laravel dependencies using Composer:
composer install4. Copy and configure the environment variables:
cp .env.example .env
php artisan key:generate5. Configure your database credentials in .env, then run:
php artisan migrate6. Serve the application:
php artisan serveThe server should now be running at http://localhost:8000.
Login:
POST /login
Body: {
"login": "adminitkpi",
"password": "magangitkpi"
}Logout:
POST /logout
Header: Authorization: Bearer {your_token}