Back to Login
IQ Building Solution Logo

IQ Building Solution Portal

API Documentation

Authentication

There are two ways to authenticate with the API:

1. User Login (Recommended for Web Applications)

Use the login endpoint to authenticate users and get their API keys:

POST /api/login.php Content-Type: application/json { "username": "admin", "password": "admin123" }
2. Direct API Key Authentication

For direct API access, include the API key in one of the following ways:

Header (Recommended)
X-API-Key: your_api_key_here
Authorization Header
Authorization: Bearer your_api_key_here
Query Parameter
GET /api/attendance.php?api_key=your_api_key_here

Base URL

https://iqbuildingsolutions.com/attendance/api/

Authentication Endpoints

POST /api/login.php

Authenticate user and get API keys

POST /api/login.php Content-Type: application/json { "username": "admin", "password": "admin123" } Response: { "success": true, "message": "Login successful", "data": { "user_id": 1, "username": "admin", "full_name": "System Administrator", "role": "admin", "session_token": "abc123...", "api_keys": [ { "api_key": "key123...", "name": "Mobile App", "is_active": true } ] } }

Attendance Endpoints

GET /api/attendance.php

Get attendance records with optional filters

GET /api/attendance.php?employee_id=1&site_id=2&date_from=2024-01-01&date_to=2024-01-31&page=1&limit=20
POST /api/attendance.php

Create new attendance record

POST /api/attendance.php Content-Type: application/json { "employee_id": 1, "date": "2024-01-15", "site_id": 2, "category_id": 3, "shift_id": 4, "advance": 100.00 }
PUT /api/attendance.php?id=1

Update attendance record

PUT /api/attendance.php?id=1 Content-Type: application/json { "employee_id": 1, "date": "2024-01-15", "site_id": 2, "category_id": 3, "shift_id": 4, "advance": 150.00 }
DELETE /api/attendance.php?id=1

Delete attendance record

DELETE /api/attendance.php?id=1

Employees Endpoints

GET /api/employees.php

Get all employees

GET /api/employees.php?page=1&limit=20
POST /api/employees.php

Create new employee

POST /api/employees.php Content-Type: application/json { "name": "John Doe" }
PUT /api/employees.php?id=1

Update employee

PUT /api/employees.php?id=1 Content-Type: application/json { "name": "John Smith" }
DELETE /api/employees.php?id=1

Delete employee

DELETE /api/employees.php?id=1

Sites Endpoints

GET /api/sites.php

Get all sites

GET /api/sites.php?page=1&limit=20
POST /api/sites.php

Create new site

POST /api/sites.php Content-Type: application/json { "name": "Construction Site A" }
PUT /api/sites.php?id=1

Update site

PUT /api/sites.php?id=1 Content-Type: application/json { "name": "Construction Site B" }
DELETE /api/sites.php?id=1

Delete site

DELETE /api/sites.php?id=1

Categories Endpoints

GET /api/categories.php

Get all categories

GET /api/categories.php?page=1&limit=20
POST /api/categories.php

Create new category

POST /api/categories.php Content-Type: application/json { "name": "Labor", "per_day_salary": 500.00 }
PUT /api/categories.php?id=1

Update category

PUT /api/categories.php?id=1 Content-Type: application/json { "name": "Senior Labor", "per_day_salary": 600.00 }
DELETE /api/categories.php?id=1

Delete category

DELETE /api/categories.php?id=1

Shifts Endpoints

GET /api/shifts.php

Get all shifts

GET /api/shifts.php?page=1&limit=20
POST /api/shifts.php

Create new shift

POST /api/shifts.php Content-Type: application/json { "name": "Morning Shift", "hours": 8.00 }
PUT /api/shifts.php?id=1

Update shift

PUT /api/shifts.php?id=1 Content-Type: application/json { "name": "Early Morning Shift", "hours": 8.00 }
DELETE /api/shifts.php?id=1

Delete shift

DELETE /api/shifts.php?id=1

Response Format

Success Response
{ "success": true, "data": [...], "pagination": { "page": 1, "limit": 20, "total": 100 } }
Error Response
{ "error": "Error message description" }
HTTP Status Codes
  • 200 - Success
  • 400 - Bad Request (invalid data)
  • 401 - Unauthorized (invalid API key)
  • 404 - Not Found
  • 405 - Method Not Allowed
  • 500 - Internal Server Error