AIPEL API is a RESTful API that allows users to manage customer data on PT. Central Digital Network. This API also supports user authentication using email or username through 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 | /customers | Retrieve all customer data |
POST | /customers | Create a new customer data |
GET | /customers/{id} | Retrieve details of a specific data |
PUT | /customers/{id} | Update a specific customer data |
DELETE | /customers/{id} | Delete a specific customer data |
- Login using email or username.
- Manage customer data (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/aipel-api.git
2. Navigate to the project directory:
cd aipel-api
3. Install Laravel dependencies using Composer:
composer install
4. Copy and configure the environment variables:
cp .env.example .env
php artisan key:generate
5. Configure your database credentials in .env
, then run:
php artisan migrate
6. Serve the application:
php artisan serve
The server should now be running at http://localhost:8000
.
Login:
POST /login
Body: {
"login": "admincdn",
"password": "magangcdn25"
}
Logout:
POST /logout
Header: Authorization: Bearer {your_token}