To use any API endpoint, first generate an authentication token:
/api/token
Request Body:
{
"email": "xxxxxx",
"password": "xxxxxx"
}
The returned token will be valid for 1 hour.
Response:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
/api/schedules
Request Headers:
Authorization: Bearer <token>
Request Body:
{
"customer_id": 1,
"checkin_date": "2025-01-01",
"checkout_date": "2025-01-10",
"wakeup_time": "07:00",
"sleep_time": "22:00"
}
Success Response: Status code 201 with schedule data
Response Body:
{
"id": 1,
"customer_id": 1,
"checkin_date": "2025-01-01",
"checkout_date": "2025-01-10",
"wakeup_time": "07:00:00",
"sleep_time": "22:00:00",
"created_at": "2023-12-01T08:00:00.000000Z",
"updated_at": "2023-12-01T08:00:00.000000Z"
}
/api/customers
Request Body:
{
"name": "John Doe",
"email": "johndoe@test.com",
"phone": "12345678",
"gender": "m",
"birthdate": "1994-05-15",
"preferences": {
"language": "ph",
"hobby": "workout"
}
}
Success Response: Status code 201 with customer data
Sample Response:
{
"id": 1,
"name": "John Doe",
"email": "johndoe@test.com",
"phone": "12345678",
"gender": "m",
"birthdate": "1994-05-15",
"preferences": {
"language": "ph",
"hobby": "workout"
},
"created_at": "2023-12-01T08:00:00.000000Z",
"updated_at": "2023-12-01T08:00:00.000000Z"
}