Introduction
Megacess Workforce Management System API - Manage staff, attendance, tasks, and locations.
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
To authenticate requests, include an Authorization header with the value "Bearer {YOUR_TOKEN}".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
You can retrieve your token by calling the POST /api/v1/auth/login endpoint with your credentials. Use the returned token in the Authorization header as Bearer {token}.
Advance Management
Display a listing of users/staff who have advance loans.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/advances?type=staff&search=john&role=manager&per_page=15&page=1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances"
);
const params = {
"type": "staff",
"search": "john",
"role": "manager",
"per_page": "15",
"page": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'type' => 'staff',
'search' => 'john',
'role' => 'manager',
'per_page' => '15',
'page' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances'
params = {
'type': 'staff',
'search': 'john',
'role': 'manager',
'per_page': '15',
'page': '1',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Users/staff with advance loans retrieved successfully",
"data": [
{
"type": "staff",
"id": 1,
"name": "Ethan Muller",
"phone": "+1234567890",
"img": null,
"total_outstanding_balance": 1250.5,
"total_loan_amount": 2000,
"total_paid_amount": 749.5,
"loan_count": 3
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created advance record.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/advances" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"type\": \"staff\",
\"staff_id\": 1,
\"user_id\": 1,
\"loan_date\": \"2025-10-27\",
\"loan_amount\": 250,
\"loan_remarks\": \"Essentials equipment\",
\"loan_status\": \"not_paid\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"type": "staff",
"staff_id": 1,
"user_id": 1,
"loan_date": "2025-10-27",
"loan_amount": 250,
"loan_remarks": "Essentials equipment",
"loan_status": "not_paid"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'type' => 'staff',
'staff_id' => 1,
'user_id' => 1,
'loan_date' => '2025-10-27',
'loan_amount' => 250.0,
'loan_remarks' => 'Essentials equipment',
'loan_status' => 'not_paid',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances'
payload = {
"type": "staff",
"staff_id": 1,
"user_id": 1,
"loan_date": "2025-10-27",
"loan_amount": 250,
"loan_remarks": "Essentials equipment",
"loan_status": "not_paid"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Advance record created successfully",
"data": {
"loan_id": 1,
"staff_id": 1,
"loan_date": "2025-10-27",
"loan_amount": "250.00",
"loan_remarks": "Essentials equipment: boots, scythe and machete",
"loan_status": "not_paid",
"created_by": 1,
"created_at": "2025-10-27T00:00:00.000000Z",
"updated_at": "2025-10-27T00:00:00.000000Z",
"staff": {
"id": 1,
"staff_fullname": "Ethan Muller"
},
"creator": {
"id": 1,
"user_fullname": "Admin1"
}
}
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"type": [
"The type field is required."
],
"loan_date": [
"The loan date field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get list of staff members for advance selection.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/advances/staff/list?search=ethan" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances/staff/list"
);
const params = {
"search": "ethan",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/list';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'ethan',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/list'
params = {
'search': 'ethan',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff list retrieved successfully",
"data": [
{
"id": 1,
"staff_fullname": "Ethan Muller",
"staff_phone": "+1234567890",
"staff_img": null
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get list of users for advance selection.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/advances/users/list?search=oikawa&role=manager" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances/users/list"
);
const params = {
"search": "oikawa",
"role": "manager",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances/users/list';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'oikawa',
'role' => 'manager',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances/users/list'
params = {
'search': 'oikawa',
'role': 'manager',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Users list retrieved successfully",
"data": [
{
"id": 1,
"user_fullname": "Oikawa Yamaguchi",
"user_nickname": "oikawa",
"user_role": "manager",
"user_img": null
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display a specific advance record detail.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/advances/staff/record/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances/staff/record/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/record/1';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/record/1'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Advance record retrieved successfully",
"data": {
"loan_id": 1,
"staff_id": 1,
"loan_date": "2025-10-27",
"loan_amount": "250.00",
"loan_paid_amount": "0.00",
"loan_remarks": "Essentials equipment: boots, scythe and machete",
"loan_status": "not_paid",
"remaining_amount": 250,
"created_by": 1,
"created_at": "2025-10-27T00:00:00.000000Z",
"updated_at": "2025-10-27T00:00:00.000000Z",
"staff": {
"id": 1,
"staff_fullname": "Ethan Muller",
"staff_phone": "+1234567890",
"staff_img": null
},
"creator": {
"id": 1,
"user_fullname": "Admin1",
"user_nickname": "admin1"
}
}
}
Example response (400, Invalid type):
{
"success": false,
"message": "Invalid type. Must be either \"staff\" or \"user\""
}
Example response (404, Record not found):
{
"success": false,
"message": "Advance record not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get the cumulative/total outstanding balance for a staff member or user.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/advances/staff/1/outstanding-balance" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances/staff/1/outstanding-balance"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/1/outstanding-balance';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/1/outstanding-balance'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Outstanding balance retrieved successfully",
"data": {
"type": "staff",
"id": 1,
"name": "Ethan Muller",
"total_outstanding_balance": 1250.5,
"total_loan_amount": 2000,
"total_paid_amount": 749.5,
"loan_count": 3
}
}
Example response (400, Invalid type):
{
"success": false,
"message": "Invalid type. Must be either \"staff\" or \"user\""
}
Example response (404, Staff/User not found):
{
"success": false,
"message": "Staff member not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the payment status of an advance record.
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/advances/staff/1/status" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"loan_status\": \"paid\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances/staff/1/status"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"loan_status": "paid"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/1/status';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'loan_status' => 'paid',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/1/status'
payload = {
"loan_status": "paid"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Advance payment status updated successfully",
"data": {
"loan_id": 1,
"staff_id": 1,
"loan_date": "2025-10-27",
"loan_amount": "250.00",
"loan_remarks": "Essentials equipment",
"loan_status": "paid",
"created_by": 1,
"created_at": "2025-10-27T00:00:00.000000Z",
"updated_at": "2025-10-27T00:00:00.000000Z",
"staff": {
"id": 1,
"staff_fullname": "Ethan Muller"
},
"creator": {
"id": 1,
"user_fullname": "Admin1"
}
}
}
Example response (404, Record not found):
{
"success": false,
"message": "Advance record not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"loan_status": [
"The loan status field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display all advance records for a specific staff member or user.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/advances/staff/1?status=not_paid" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/advances/staff/1"
);
const params = {
"status": "not_paid",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/1';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'status' => 'not_paid',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/advances/staff/1'
params = {
'status': 'not_paid',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Advance records retrieved successfully",
"data": {
"type": "staff",
"id": 1,
"name": "Ethan Muller",
"total_outstanding_balance": 1250.5,
"total_loan_amount": 2000,
"total_paid_amount": 749.5,
"loan_count": 3,
"advances": [
{
"loan_id": 1,
"staff_id": 1,
"loan_date": "2025-10-27",
"loan_amount": "250.00",
"loan_paid_amount": "0.00",
"loan_remarks": "Essentials equipment: boots, scythe and machete",
"loan_status": "not_paid",
"remaining_amount": 250,
"created_by": 1,
"created_at": "2025-10-27T00:00:00.000000Z",
"updated_at": "2025-10-27T00:00:00.000000Z",
"creator": {
"id": 1,
"user_fullname": "Admin1",
"user_nickname": "admin1"
}
}
]
}
}
Example response (400, Invalid type):
{
"success": false,
"message": "Invalid type. Must be either \"staff\" or \"user\""
}
Example response (404, Staff/User not found):
{
"success": false,
"message": "Staff member not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Analytics
Get dashboard data including pending leave, absence, payroll, yield, and equipment usage.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/dashboard?month=10&year=2025" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/dashboard"
);
const params = {
"month": "10",
"year": "2025",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/dashboard';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '10',
'year' => '2025',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/dashboard'
params = {
'month': '10',
'year': '2025',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"pending_leave": 1,
"number_of_absence": 1,
"pending_payroll": 1,
"total_yield_harvested": {
"total": 5.17999999999999971578290569595992565155029296875,
"unit": "ton",
"recent_harvested_area": {
"location_id": 2,
"location_name": "B01",
"total": 0.2399999999999999911182158029987476766109466552734375
}
},
"total_equipment_used": {
"bags": 32,
"liters": 61
}
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get manager analytics dashboard data.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/manager?location_id=1&start_date=2025-01-01&end_date=2025-01-31&task_type=manuring&fertilizer_type=NPK&sanitation_type=spraying" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/manager"
);
const params = {
"location_id": "1",
"start_date": "2025-01-01",
"end_date": "2025-01-31",
"task_type": "manuring",
"fertilizer_type": "NPK",
"sanitation_type": "spraying",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/manager';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'location_id' => '1',
'start_date' => '2025-01-01',
'end_date' => '2025-01-31',
'task_type' => 'manuring',
'fertilizer_type' => 'NPK',
'sanitation_type' => 'spraying',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/manager'
params = {
'location_id': '1',
'start_date': '2025-01-01',
'end_date': '2025-01-31',
'task_type': 'manuring',
'fertilizer_type': 'NPK',
'sanitation_type': 'spraying',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"usage_analytics": {
"fertilizer_usage": {
"total_amount": 150.5,
"unit": "kg",
"task_count": 5
},
"herbicide_usage": {
"total_amount": 75,
"unit": "L",
"task_count": 3
},
"fuel_usage": {
"total_amount": 45,
"unit": "L",
"task_count": 2
}
},
"task_analytics": {
"total_tasks": 25,
"in_progress": 8,
"pending": 5,
"rejected": 2,
"completed": 10
}
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get detailed usage analytics with breakdown by location.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/usage-breakdown?start_date=2025-01-01&end_date=2025-01-31&task_type=manuring&fertilizer_type=NPK&sanitation_type=spraying" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/usage-breakdown"
);
const params = {
"start_date": "2025-01-01",
"end_date": "2025-01-31",
"task_type": "manuring",
"fertilizer_type": "NPK",
"sanitation_type": "spraying",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/usage-breakdown';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'start_date' => '2025-01-01',
'end_date' => '2025-01-31',
'task_type' => 'manuring',
'fertilizer_type' => 'NPK',
'sanitation_type' => 'spraying',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/usage-breakdown'
params = {
'start_date': '2025-01-01',
'end_date': '2025-01-31',
'task_type': 'manuring',
'fertilizer_type': 'NPK',
'sanitation_type': 'spraying',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"fertilizer_breakdown": [
{
"location_id": 1,
"location_name": "A01",
"total_amount": 50,
"task_count": 2
}
],
"herbicide_breakdown": []
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get task completion analytics with monthly and yearly breakdowns.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/task-completion?year=2025&location_id=1&task_type=manuring" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/task-completion"
);
const params = {
"year": "2025",
"location_id": "1",
"task_type": "manuring",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/task-completion';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'year' => '2025',
'location_id' => '1',
'task_type' => 'manuring',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/task-completion'
params = {
'year': '2025',
'location_id': '1',
'task_type': 'manuring',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Monthly breakdown (year specified)):
{
"success": true,
"data": {
"grouping": "monthly",
"year": 2025,
"total_completed": 750,
"data": [
{
"month": 1,
"month_name": "Jan",
"count": 67
},
{
"month": 2,
"month_name": "Feb",
"count": 59
},
{
"month": 3,
"month_name": "Mar",
"count": 67
},
{
"month": 4,
"month_name": "Apr",
"count": 56
},
{
"month": 5,
"month_name": "May",
"count": 59
},
{
"month": 6,
"month_name": "Jun",
"count": 69
},
{
"month": 7,
"month_name": "Jul",
"count": 69
},
{
"month": 8,
"month_name": "Aug",
"count": 65
},
{
"month": 9,
"month_name": "Sep",
"count": 60
},
{
"month": 10,
"month_name": "Oct",
"count": 65
},
{
"month": 11,
"month_name": "Nov",
"count": 60
},
{
"month": 12,
"month_name": "Dec",
"count": 60
}
]
}
}
Example response (200, Yearly breakdown (no year specified)):
{
"success": true,
"data": {
"grouping": "yearly",
"total_completed": 1500,
"data": [
{
"year": 2023,
"count": 450
},
{
"year": 2024,
"count": 550
},
{
"year": 2025,
"count": 500
}
]
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get task completion analytics by blocks (locations).
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-blocks?year=2025&month=3&week=15" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-blocks"
);
const params = {
"year": "2025",
"month": "3",
"week": "15",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-blocks';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'year' => '2025',
'month' => '3',
'week' => '15',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-blocks'
params = {
'year': '2025',
'month': '3',
'week': '15',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, By blocks (year filter)):
{
"success": true,
"data": {
"filter": {
"type": "year",
"value": 2025
},
"total_completed": 240,
"data": [
{
"location_id": 1,
"location_name": "A01",
"count": 15
},
{
"location_id": 2,
"location_name": "A02",
"count": 20
},
{
"location_id": 3,
"location_name": "B01",
"count": 25
}
]
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get resource usage by task type.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/resource-usage?task_type=manuring&sanitation_type=spraying&start_date=2025-01-01&end_date=2025-12-31&location_id=1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/resource-usage"
);
const params = {
"task_type": "manuring",
"sanitation_type": "spraying",
"start_date": "2025-01-01",
"end_date": "2025-12-31",
"location_id": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/resource-usage';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'task_type' => 'manuring',
'sanitation_type' => 'spraying',
'start_date' => '2025-01-01',
'end_date' => '2025-12-31',
'location_id' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/resource-usage'
params = {
'task_type': 'manuring',
'sanitation_type': 'spraying',
'start_date': '2025-01-01',
'end_date': '2025-12-31',
'location_id': '1',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success - Fertilizer Usage):
{
"success": true,
"data": {
"resource_type": "fertilizer",
"unit": "kg",
"records": [
{
"date": "25/10/2025",
"estate_officer": "Paul Don",
"block": "A02",
"amount": 20
}
]
}
}
Example response (200, Success - Herbicide Usage):
{
"success": true,
"data": {
"resource_type": "herbicide",
"unit": "liter",
"records": [
{
"date": "25/10/2025",
"estate_officer": "Paul Don",
"block": "A02",
"amount": 20
}
]
}
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"task_type": [
"The task type field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get task completion analytics by Estate Officers (mandors).
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-mandors?year=2025&month=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-mandors"
);
const params = {
"year": "2025",
"month": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-mandors';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'year' => '2025',
'month' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/tasks-by-mandors'
params = {
'year': '2025',
'month': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success - Monthly):
{
"success": true,
"data": {
"period": "October 2025",
"filter": {
"type": "month",
"year": 2025,
"month": 10
},
"records": [
{
"estate_officer_id": 1,
"estate_officer_name": "Paul Don",
"team_task_completion": 28
},
{
"estate_officer_id": 2,
"estate_officer_name": "Martin Agus",
"team_task_completion": 24
}
]
}
}
Example response (200, Success - Yearly):
{
"success": true,
"data": {
"period": "2025",
"filter": {
"type": "year",
"year": 2025
},
"records": [
{
"estate_officer_id": 1,
"estate_officer_name": "Paul Don",
"team_task_completion": 250
}
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get attendance rate by Estate Officers (mandors).
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/attendance-by-mandors?year=2025&month=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/attendance-by-mandors"
);
const params = {
"year": "2025",
"month": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/attendance-by-mandors';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'year' => '2025',
'month' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/attendance-by-mandors'
params = {
'year': '2025',
'month': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success - Monthly):
{
"success": true,
"data": {
"period": "October 2025",
"filter": {
"type": "month",
"year": 2025,
"month": 10
},
"records": [
{
"estate_officer_id": 1,
"estate_officer_name": "Adam Graham",
"attendance_rate": 100
},
{
"estate_officer_id": 2,
"estate_officer_name": "Danial O",
"attendance_rate": 100
},
{
"estate_officer_id": 3,
"estate_officer_name": "Martin Agus",
"attendance_rate": 100
},
{
"estate_officer_id": 4,
"estate_officer_name": "Tunku Ibrahim",
"attendance_rate": 98
}
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get list of absent workers (staff) with their absent dates.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/absent-workers?year=2025&month=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/absent-workers"
);
const params = {
"year": "2025",
"month": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/absent-workers';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'year' => '2025',
'month' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/absent-workers'
params = {
'year': '2025',
'month': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"period": "October 2025",
"filter": {
"type": "month",
"year": 2025,
"month": 10
},
"records": [
{
"staff_id": 1,
"staff_name": "Ali bin Abu",
"absent_dates": [
"2025-10-05",
"2025-10-12",
"2025-10-18"
],
"total_absent_days": 3
}
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get audited summary grouped by payment rate categories.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/audited-summary?year=2025&month=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/audited-summary"
);
const params = {
"year": "2025",
"month": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/audited-summary';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'year' => '2025',
'month' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/audited-summary'
params = {
'year': '2025',
'month': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"period": "October 2025",
"filter": {
"type": "month",
"year": 2025,
"month": 10
},
"summary": [
{
"category_id": 1,
"category_name": "Normal Pruning",
"task_type": "pruning",
"task_name": "Pruning",
"unit": "per palm",
"total_value": 14,
"recent_block": {
"location_id": 2,
"location_name": "A02",
"checked_by": "Ethan Muller",
"checked_at": "2025-10-13"
}
},
{
"category_id": 2,
"category_name": "Routine Pruning",
"task_type": "pruning",
"task_name": "Pruning",
"unit": "per acre",
"total_value": 115.06999999999999317878973670303821563720703125,
"recent_block": {
"location_id": 3,
"location_name": "C01",
"checked_by": "Ethan Muller",
"checked_at": "2025-10-24"
}
}
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get resources analytics including vehicles, car spare parts, and fuel data.
requires authentication
This endpoint provides comprehensive analytics for organizational resources with flexible time period filtering.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/resources-usage?period=month" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/resources-usage"
);
const params = {
"period": "month",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/resources-usage';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'period' => 'month',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/resources-usage'
params = {
'period': 'month',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success - Monthly Data (Default)):
{
"success": true,
"data": {
"period": "month",
"vehicle_analytics": {
"total_vehicles": 25,
"available": 18,
"in_use": 5,
"under_maintenance": 2,
"bookings_trend": [
{
"period": 1,
"period_label": "Jan",
"bookings": 12
},
{
"period": 2,
"period_label": "Feb",
"bookings": 19
},
{
"period": 3,
"period_label": "Mar",
"bookings": 14
}
]
},
"tools_analytics": {
"total_spare_parts": 78,
"available": 60,
"used": 18,
"status_distribution": [
{
"status": "Available",
"count": 60
},
{
"status": "Used",
"count": 18
}
]
},
"fuel_analytics": {
"remaining_fuel": 540,
"total_fuel_bought": 1000,
"total_fuel_used": 460,
"fuel_usage_trend": [
{
"period": 1,
"period_label": "Jan",
"fuel_used": 180,
"fuel_used_by_type": [
{
"fuel_type": "Petrol",
"fuel_used": 80
},
{
"fuel_type": "Diesel",
"fuel_used": 100
}
]
}
],
"fuel_by_type": [
{
"fuel_type": "Petrol",
"total_fuel_bought": 500,
"total_fuel_used": 300,
"remaining_fuel": 200
}
]
}
}
}
Example response (200, Success - Daily Data):
{
"success": true,
"data": {
"period": "day",
"vehicle_analytics": {
"total_vehicles": 25,
"available": 18,
"in_use": 5,
"under_maintenance": 2,
"bookings_trend": [
{
"period": "2025-12-01",
"period_label": "Dec 01",
"bookings": 3
},
{
"period": "2025-12-02",
"period_label": "Dec 02",
"bookings": 5
}
]
},
"tools_analytics": {
"total_spare_parts": 78,
"available": 60,
"used": 18,
"status_distribution": []
},
"fuel_analytics": {
"remaining_fuel": 540,
"total_fuel_bought": 1000,
"total_fuel_used": 460,
"fuel_usage_trend": [
{
"period": "2025-12-01",
"period_label": "Dec 01",
"fuel_used": 15.5,
"fuel_used_by_type": []
}
],
"fuel_by_type": []
}
}
}
Example response (200, Success - Weekly Data):
{
"success": true,
"data": {
"period": "week",
"vehicle_analytics": {
"total_vehicles": 25,
"available": 18,
"in_use": 5,
"under_maintenance": 2,
"bookings_trend": [
{
"period": "2025-11-04",
"period_label": "Week 45",
"bookings": 18
},
{
"period": "2025-11-11",
"period_label": "Week 46",
"bookings": 22
}
]
},
"tools_analytics": {},
"fuel_analytics": {
"remaining_fuel": 540,
"total_fuel_bought": 1000,
"total_fuel_used": 460,
"fuel_usage_trend": [
{
"period": "2025-11-04",
"period_label": "Week 45",
"fuel_used": 85.5,
"fuel_used_by_type": []
}
],
"fuel_by_type": []
}
}
}
Example response (200, Success - Yearly Data):
{
"success": true,
"data": {
"period": "year",
"vehicle_analytics": {
"total_vehicles": 25,
"available": 18,
"in_use": 5,
"under_maintenance": 2,
"bookings_trend": [
{
"period": 2021,
"period_label": "2021",
"bookings": 145
},
{
"period": 2022,
"period_label": "2022",
"bookings": 178
},
{
"period": 2023,
"period_label": "2023",
"bookings": 210
},
{
"period": 2024,
"period_label": "2024",
"bookings": 198
},
{
"period": 2025,
"period_label": "2025",
"bookings": 85
}
]
},
"tools_analytics": {},
"fuel_analytics": {
"remaining_fuel": 540,
"total_fuel_bought": 1000,
"total_fuel_used": 460,
"fuel_usage_trend": [
{
"period": 2021,
"period_label": "2021",
"fuel_used": 2400,
"fuel_used_by_type": []
}
],
"fuel_by_type": []
}
}
}
Example response (400, Invalid Period):
{
"success": false,
"message": "Invalid period. Allowed values: day, week, month, year"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (500, Server Error):
{
"success": false,
"message": "Failed to fetch resources analytics.",
"error": "Error message here"
}
## Response Data Structure
### Vehicle Analytics
- **total_vehicles**: Total number of vehicles in the system
- **available**: Number of vehicles with "Available" status
- **in_use**: Number of vehicles currently in use
- **under_maintenance**: Number of vehicles under maintenance
- **bookings_trend**: Array of booking counts for the selected time period
### Tools Analytics (Car Spare Parts)
- **total_spare_parts**: Total count of all spare parts/tools
- **available**: Spare parts not assigned to any vehicle (vehicle_id is null)
- **used**: Spare parts currently assigned to vehicles
- **status_distribution**: Breakdown for visualization (donut/pie charts)
### Fuel Analytics
- **remaining_fuel**: Total remaining fuel across all types (bought - used)
- **total_fuel_bought**: Sum of all fuel purchases
- **total_fuel_used**: Sum of all fuel consumption
- **fuel_usage_trend**: Fuel consumption trend for the selected period
- Each entry includes breakdown by fuel type (Petrol, Diesel, Hydraulic Oils)
- **fuel_by_type**: Overall fuel statistics per fuel type
## Period Field Values
The `period` field in trend arrays varies by the selected time period:
- **day**: ISO date string (e.g., "2025-12-08")
- **week**: ISO date of week start (e.g., "2025-12-01")
- **month**: Month number 1-12
- **year**: Year number (e.g., 2025)
The `period_label` field provides human-readable labels:
- **day**: "Dec 08" (short month + day)
- **week**: "Week 49" (ISO week number)
- **month**: "Dec" (short month name)
- **year**: "2025" (year as string)
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Attendance
Get All Attendance Records
requires authentication
Retrieve a paginated list of all attendance records with optional month filtering.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/attendance?month=2025-01&page=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"month\": \"6425-59\",
\"page\": 4,
\"per_page\": 17
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/attendance"
);
const params = {
"month": "2025-01",
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"month": "6425-59",
"page": 4,
"per_page": 17
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/attendance';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '2025-01',
'page' => '1',
'per_page' => '10',
],
'json' => [
'month' => '6425-59',
'page' => 4,
'per_page' => 17,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/attendance'
payload = {
"month": "6425-59",
"page": 4,
"per_page": 17
}
params = {
'month': '2025-01',
'page': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "OK",
"data": {
"current_page": 1,
"per_page": 15,
"total": 75,
"last_page": 5,
"from": 1,
"to": 15,
"data": [
{
"id": 1,
"date": "2025-01-15",
"status": "active",
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
]
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check Date Attendance ID
requires authentication
Check if a date attendance record exists for the given date and return its ID.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/attendance/check?date=2025-01-15" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date\": \"2026-01-12T11:56:42\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/attendance/check"
);
const params = {
"date": "2025-01-15",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date": "2026-01-12T11:56:42"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/attendance/check';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'date' => '2025-01-15',
],
'json' => [
'date' => '2026-01-12T11:56:42',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/attendance/check'
payload = {
"date": "2026-01-12T11:56:42"
}
params = {
'date': '2025-01-15',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Found):
{
"success": true,
"message": "Date attendance found",
"data": {
"id": 1,
"date": "2025-01-15",
"status": "active",
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (200, Not Found):
{
"success": true,
"message": "Date attendance ID does not exist yet",
"data": null
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create New Attendance Date
requires authentication
Create a new date attendance record. Duplicate dates are not allowed.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/attendance" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date\": \"2025-01-15\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/attendance"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date": "2025-01-15"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/attendance';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date' => '2025-01-15',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/attendance'
payload = {
"date": "2025-01-15"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Duplicate Date Error):
{
"success": true,
"message": "Date attendance already exists",
"data": {
"id": 1,
"date": "2025-01-15",
"status": "active",
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, Success):
{
"success": true,
"message": "Date attendance created successfully",
"data": {
"id": 1,
"date": "2025-01-15",
"status": "active",
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to manage attendance"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete Attendance Date (Set Status to Inactive)
requires authentication
Set the attendance date status to inactive instead of physically deleting the record.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/attendance/architecto" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/attendance/architecto"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/attendance/architecto';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/attendance/architecto'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Date attendance deleted successfully",
}
Example response (200, Already Inactive):
{
"success": true,
"message": "Date attendance already inactive"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to manage attendance"
}
Example response (404, Not Found):
{
"success": false,
"message": "Date attendance not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Authentication
Login
Authenticate a user and receive a Sanctum API token.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/auth/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"user_nickname\": \"johndoe\",
\"password\": \"password123\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/auth/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"user_nickname": "johndoe",
"password": "password123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/auth/login';
$response = $client->post(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'user_nickname' => 'johndoe',
'password' => 'password123',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/auth/login'
payload = {
"user_nickname": "johndoe",
"password": "password123"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Successful login):
{
"success": true,
"message": "Logged in",
"data": {
"token": "1|abcdefghijklmnopqrstuvwxyz1234567890",
"token_type": "Bearer",
"user": {
"id": 1,
"user_nickname": "johndoe",
"user_fullname": "John Doe",
"user_role": "admin",
"user_img": null,
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_employment_start_date": "2024-01-15",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890"
}
}
}
Example response (401, Invalid credentials):
{
"success": false,
"message": "Invalid credentials"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Register
Register a new user account.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/auth/register" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"user_nickname\": \"johndoe\",
\"user_fullname\": \"John Doe\",
\"password\": \"password123\",
\"user_role\": \"manager\",
\"user_gender\": \"male\",
\"user_dob\": \"1990-01-01\",
\"user_employment_start_date\": \"2024-01-15\",
\"user_phone\": \"+1234567890\",
\"user_ic\": \"123456789012\",
\"user_bank_name\": \"Maybank\",
\"user_bank_number\": \"1234567890\",
\"user_kwsp_number\": \"1234567890\",
\"user_img\": \"https:\\/\\/example.com\\/image.jpg\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/auth/register"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"user_nickname": "johndoe",
"user_fullname": "John Doe",
"password": "password123",
"user_role": "manager",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_employment_start_date": "2024-01-15",
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_img": "https:\/\/example.com\/image.jpg"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/auth/register';
$response = $client->post(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'user_nickname' => 'johndoe',
'user_fullname' => 'John Doe',
'password' => 'password123',
'user_role' => 'manager',
'user_gender' => 'male',
'user_dob' => '1990-01-01',
'user_employment_start_date' => '2024-01-15',
'user_phone' => '+1234567890',
'user_ic' => '123456789012',
'user_bank_name' => 'Maybank',
'user_bank_number' => '1234567890',
'user_kwsp_number' => '1234567890',
'user_img' => 'https://example.com/image.jpg',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/auth/register'
payload = {
"user_nickname": "johndoe",
"user_fullname": "John Doe",
"password": "password123",
"user_role": "manager",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_employment_start_date": "2024-01-15",
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_img": "https:\/\/example.com\/image.jpg"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Successful registration):
{
"success": true,
"message": "User registered successfully",
"data": {
"id": 1,
"user_nickname": "johndoe",
"user_fullname": "John Doe",
"user_role": "manager",
"user_img": null,
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15"
}
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"user_nickname": [
"The user nickname has already been taken."
],
"user_fullname": [
"The user fullname has already been taken."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Current User
requires authentication
Retrieve the currently authenticated user's information.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/profile" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/profile"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/profile';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/profile'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "OK",
"data": {
"id": 1,
"user_nickname": "johndoe",
"user_fullname": "John Doe",
"user_role": "admin",
"user_img": null,
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15",
"attendance_count_month": 15
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update User Profile
requires authentication
Update the currently authenticated user's profile information. Users can update their image, phone, password, and other profile fields.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/profile" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"user_fullname\": \"b\",
\"user_nickname\": \"n\",
\"user_phone\": \"+1234567890\",
\"user_password\": \"password123\",
\"user_role\": \"mandor\",
\"user_gender\": \"male\",
\"user_dob\": \"1990-01-01\",
\"user_ic\": \"123456789012\",
\"user_bank_name\": \"Maybank\",
\"user_bank_number\": \"1234567890\",
\"user_kwsp_number\": \"1234567890\",
\"user_employment_start_date\": \"2024-01-15\",
\"user_img\": \"https:\\/\\/example.com\\/image.jpg\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/profile"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"user_fullname": "b",
"user_nickname": "n",
"user_phone": "+1234567890",
"user_password": "password123",
"user_role": "mandor",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_ic": "123456789012",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15",
"user_img": "https:\/\/example.com\/image.jpg"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/profile';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'user_fullname' => 'b',
'user_nickname' => 'n',
'user_phone' => '+1234567890',
'user_password' => 'password123',
'user_role' => 'mandor',
'user_gender' => 'male',
'user_dob' => '1990-01-01',
'user_ic' => '123456789012',
'user_bank_name' => 'Maybank',
'user_bank_number' => '1234567890',
'user_kwsp_number' => '1234567890',
'user_employment_start_date' => '2024-01-15',
'user_img' => 'https://example.com/image.jpg',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/profile'
payload = {
"user_fullname": "b",
"user_nickname": "n",
"user_phone": "+1234567890",
"user_password": "password123",
"user_role": "mandor",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_ic": "123456789012",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15",
"user_img": "https:\/\/example.com\/image.jpg"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "User updated successfully",
"data": {
"id": 1,
"user_nickname": "johndoe",
"user_fullname": "John Doe",
"user_img": "https://example.com/image.jpg",
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_role": "admin",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"user_nickname": [
"The user nickname field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Logout
requires authentication
Revoke all API tokens for the authenticated user.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/auth/logout" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/auth/logout"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/auth/logout';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/auth/logout'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "OK",
"data": "Logged out"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Change Password
requires authentication
Allow the authenticated user to update their password after verifying the current password.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/auth/change-password" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"current_password\": \"architecto\",
\"password\": \"|]|{+-\",
\"password_confirmation\": \"architecto\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/auth/change-password"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"current_password": "architecto",
"password": "|]|{+-",
"password_confirmation": "architecto"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/auth/change-password';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'current_password' => 'architecto',
'password' => '|]|{+-',
'password_confirmation' => 'architecto',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/auth/change-password'
payload = {
"current_password": "architecto",
"password": "|]|{+-",
"password_confirmation": "architecto"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Password updated successfully"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"current_password": [
"The provided password does not match your current password."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Car Spare Parts Management
Get all car spare parts.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tools?search=Brake+Pad&status=available&vehicle_id=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tools"
);
const params = {
"search": "Brake Pad",
"status": "available",
"vehicle_id": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tools';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'Brake Pad',
'status' => 'available',
'vehicle_id' => '1',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tools'
params = {
'search': 'Brake Pad',
'status': 'available',
'vehicle_id': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Spare parts retrieved successfully",
"data": [
{
"id": 1,
"name": "Brake Pad",
"vehicle_id": null,
"status": "available",
"vehicle": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
},
{
"id": 2,
"name": "Oil Filter",
"vehicle_id": 1,
"status": "used",
"vehicle": {
"id": 1,
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created spare part.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tools" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Brake Pad\",
\"vehicle_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tools"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Brake Pad",
"vehicle_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tools';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Brake Pad',
'vehicle_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tools'
payload = {
"name": "Brake Pad",
"vehicle_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Spare part created successfully",
"data": {
"id": 1,
"name": "Brake Pad",
"vehicle_id": null,
"status": "available",
"vehicle": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specified spare part.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tools/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tools/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tools/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tools/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Spare part retrieved successfully",
"data": {
"id": 1,
"name": "Brake Pad",
"vehicle_id": null,
"status": "available",
"vehicle": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified spare part.
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/tools/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Brake Pad\",
\"vehicle_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tools/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Brake Pad",
"vehicle_id": 1
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tools/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Brake Pad',
'vehicle_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tools/16'
payload = {
"name": "Brake Pad",
"vehicle_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Spare part updated successfully",
"data": {
"id": 1,
"name": "Brake Pad",
"vehicle_id": 1,
"status": "used",
"vehicle": {
"id": 1,
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the specified spare part.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/tools/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tools/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tools/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tools/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Spare part deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Checker Analytics
Get Checker Analytics Overview Retrieves analytics data for checkers including task counts and absent people statistics. Only accessible by users with 'checker' role.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/checker" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/checker"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/checker';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/checker'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"message": "Analytics retrieved successfully",
"data": {
"pending_task_count": 5,
"complete_task_count": 12,
"absent_people_count": 3,
"payroll_date": "2025-10-16",
"time_until_payroll": 10
}
}
Example response (401):
{
"success": false,
"message": "Unauthenticated"
}
Example response (403):
{
"success": false,
"message": "You are not authorized to access this resource"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Pending Tasks for Checker Retrieves a list of pending tasks. Only accessible by users with 'checker' role.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/analytics/checker/pending-tasks" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/analytics/checker/pending-tasks"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/analytics/checker/pending-tasks';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/analytics/checker/pending-tasks'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200):
{
"success": true,
"message": "Pending tasks retrieved successfully",
"data": [
{
"id": 1,
"task_name": "Sample Task",
"task_description": "Task description here",
"task_status": "pending",
"created_by": 1,
"created_at": "2024-01-01T00:00:00.000000Z",
"updated_at": "2024-01-01T00:00:00.000000Z"
}
]
}
Example response (401):
{
"success": false,
"message": "Unauthenticated"
}
Example response (403):
{
"success": false,
"message": "You are not authorized to access this resource"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Endpoints
Temporary File Access (Public, Signed URL)
Serve a file via a temporary signed URL without requiring authentication. This route is public but protected by signature verification.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/files/temporary/|{+-0p" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/temporary/|{+-0p"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/temporary/|{+-0p';
$response = $client->get(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/temporary/|{+-0p'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (403):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS, PATCH
access-control-allow-headers: Content-Type, Authorization, X-Requested-With, Accept, Origin, X-CSRF-TOKEN
access-control-allow-credentials: true
{
"success": false,
"message": "Invalid signature.",
"status_code": 403
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
File Transfer Management
Upload Single File
requires authentication
Upload a single file to the file storage system with optional directory and metadata. Supports various file types including documents, images, and videos.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/files/upload" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: multipart/form-data" \
--header "Accept: application/json" \
--form "directory=uploads/documents"\
--form "metadata[description]=Important document"\
--form "metadata[category]=legal"\
--form "file=@/tmp/php2icvk6" const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/upload"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('directory', 'uploads/documents');
body.append('metadata[description]', 'Important document');
body.append('metadata[category]', 'legal');
body.append('file', document.querySelector('input[name="file"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/upload';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
],
'multipart' => [
[
'name' => 'directory',
'contents' => 'uploads/documents'
],
[
'name' => 'metadata[description]',
'contents' => 'Important document'
],
[
'name' => 'metadata[category]',
'contents' => 'legal'
],
[
'name' => 'file',
'contents' => fopen('/tmp/php2icvk6', 'r')
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/upload'
files = {
'directory': (None, 'uploads/documents'),
'metadata[description]': (None, 'Important document'),
'metadata[category]': (None, 'legal'),
'file': open('/tmp/php2icvk6', 'rb')}
payload = {
"directory": "uploads\/documents",
"metadata[description]": "Important document",
"metadata[category]": "legal"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'multipart/form-data',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, files=files)
response.json()Example response (201, Successful upload):
{
"success": true,
"message": "File uploaded successfully",
"data": {
"path": "uploads/documents/document_20250115_123456.pdf",
"name": "document.pdf",
"size": 1024000,
"mime_type": "application/pdf",
"url": "https://example.com/storage/uploads/documents/document_20250115_123456.pdf",
"metadata": {
"description": "Important document",
"category": "legal"
}
}
}
Example response (400, Upload failed):
{
"success": false,
"message": "File upload failed",
"errors": [
"Insufficient storage space"
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"file": [
"The file field is required."
],
"file.0": [
"The file must not be greater than 10240 kilobytes."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Upload Multiple Files
requires authentication
Upload multiple files to the file storage system with optional directory and metadata. Maximum 10 files per request, each file limited to 100MB. Supports various file types including documents, images, and videos.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/files/upload-multiple" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"files\": null,
\"directory\": \"uploads\\/batch\",
\"metadata[batch_id]\": \"batch_001\",
\"metadata[uploaded_by]\": \"user123\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/upload-multiple"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"files": null,
"directory": "uploads\/batch",
"metadata[batch_id]": "batch_001",
"metadata[uploaded_by]": "user123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/upload-multiple';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'files' => null,
'directory' => 'uploads/batch',
'metadata[batch_id]' => 'batch_001',
'metadata[uploaded_by]' => 'user123',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/upload-multiple'
payload = {
"files": null,
"directory": "uploads\/batch",
"metadata[batch_id]": "batch_001",
"metadata[uploaded_by]": "user123"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Successful upload):
{
"success": true,
"message": "Files uploaded successfully",
"data": {
"uploaded_files": [
{
"path": "uploads/batch/document_20250115_123456.pdf",
"name": "document.pdf",
"size": 1024000,
"mime_type": "application/pdf",
"url": "https://example.com/storage/uploads/batch/document_20250115_123456.pdf"
},
{
"path": "uploads/batch/image_20250115_123457.jpg",
"name": "image.jpg",
"size": 512000,
"mime_type": "image/jpeg",
"url": "https://example.com/storage/uploads/batch/image_20250115_123457.jpg"
}
],
"total_files": 2,
"total_size": 1536000,
"metadata": {
"batch_id": "batch_001",
"uploaded_by": "user123"
}
}
}
Example response (400, Upload failed):
{
"success": false,
"message": "Files upload failed",
"errors": [
"Some files failed to upload"
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"files": [
"The files field is required."
],
"files.0": [
"The files.0 must not be greater than 10240 kilobytes."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Download File
requires authentication
Download a file from the storage system. Returns the file as a streamed response.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/files/download?path=uploads%2Fdocuments%2Fdocument.pdf&download_name=my_document.pdf" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"path\": \"architecto\",
\"download_name\": \"n\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/download"
);
const params = {
"path": "uploads/documents/document.pdf",
"download_name": "my_document.pdf",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"path": "architecto",
"download_name": "n"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/download';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'path' => 'uploads/documents/document.pdf',
'download_name' => 'my_document.pdf',
],
'json' => [
'path' => 'architecto',
'download_name' => 'n',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/download'
payload = {
"path": "architecto",
"download_name": "n"
}
params = {
'path': 'uploads/documents/document.pdf',
'download_name': 'my_document.pdf',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Successful download):
{
"file": "Binary file content"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, File not found):
{
"success": false,
"message": "File not found",
"errors": [
"The specified file does not exist"
]
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"path": [
"The path field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get File URL
requires authentication
Get a public URL for accessing a file without downloading it.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/files/url?path=uploads%2Fdocuments%2Fdocument.pdf" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"path\": \"architecto\",
\"expires\": 22
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/url"
);
const params = {
"path": "uploads/documents/document.pdf",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"path": "architecto",
"expires": 22
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/url';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'path' => 'uploads/documents/document.pdf',
],
'json' => [
'path' => 'architecto',
'expires' => 22,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/url'
payload = {
"path": "architecto",
"expires": 22
}
params = {
'path': 'uploads/documents/document.pdf',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "File URL retrieved successfully",
"data": {
"url": "https://example.com/storage/uploads/documents/document.pdf",
"path": "uploads/documents/document.pdf",
"expires_at": "2025-01-16T12:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, File not found):
{
"success": false,
"message": "File not found",
"errors": [
"The specified file does not exist"
]
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"path": [
"The path field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete File
requires authentication
Delete a file from the storage system.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/files/delete" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"path\": \"uploads\\/documents\\/document.pdf\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/delete"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"path": "uploads\/documents\/document.pdf"
};
fetch(url, {
method: "DELETE",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/delete';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'path' => 'uploads/documents/document.pdf',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/delete'
payload = {
"path": "uploads\/documents\/document.pdf"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "File deleted successfully",
"data": {
"path": "uploads/documents/document.pdf",
"deleted_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, File not found):
{
"success": false,
"message": "File not found",
"errors": [
"The specified file does not exist"
]
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"path": [
"The path field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Files
requires authentication
List all files in a directory with optional recursive search.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/files/list?directory=uploads%2Fdocuments&recursive=1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"directory\": \"b\",
\"recursive\": false
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/list"
);
const params = {
"directory": "uploads/documents",
"recursive": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"directory": "b",
"recursive": false
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/list';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'directory' => 'uploads/documents',
'recursive' => '1',
],
'json' => [
'directory' => 'b',
'recursive' => false,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/list'
payload = {
"directory": "b",
"recursive": false
}
params = {
'directory': 'uploads/documents',
'recursive': '1',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Files listed successfully",
"data": {
"files": [
{
"name": "document.pdf",
"path": "uploads/documents/document.pdf",
"size": 1024000,
"mime_type": "application/pdf",
"url": "https://example.com/storage/uploads/documents/document.pdf",
"created_at": "2025-01-15T10:00:00.000000Z",
"modified_at": "2025-01-15T10:00:00.000000Z"
},
{
"name": "image.jpg",
"path": "uploads/documents/image.jpg",
"size": 512000,
"mime_type": "image/jpeg",
"url": "https://example.com/storage/uploads/documents/image.jpg",
"created_at": "2025-01-15T11:00:00.000000Z",
"modified_at": "2025-01-15T11:00:00.000000Z"
}
],
"directory": "uploads/documents",
"total_files": 2,
"total_size": 1536000
}
}
Example response (400, Error):
{
"success": false,
"message": "Failed to list files",
"errors": [
"Directory access denied"
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"recursive": [
"The recursive field must be true or false."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Move File
requires authentication
Move or rename a file from one location to another.
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/files/move" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"uploads\\/documents\\/old_name.pdf\",
\"to\": \"uploads\\/archive\\/new_name.pdf\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/move"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"from": "uploads\/documents\/old_name.pdf",
"to": "uploads\/archive\/new_name.pdf"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/move';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'from' => 'uploads/documents/old_name.pdf',
'to' => 'uploads/archive/new_name.pdf',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/move'
payload = {
"from": "uploads\/documents\/old_name.pdf",
"to": "uploads\/archive\/new_name.pdf"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "File moved successfully",
"data": {
"from": "uploads/documents/old_name.pdf",
"to": "uploads/archive/new_name.pdf",
"moved_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (400, Move failed):
{
"success": false,
"message": "File move failed",
"errors": [
"Source file not found",
"Destination already exists"
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"from": [
"The from field is required."
],
"to": [
"The to field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Copy File
requires authentication
Create a copy of a file at a new location.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/files/copy" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"from\": \"uploads\\/documents\\/original.pdf\",
\"to\": \"uploads\\/backup\\/copy_of_original.pdf\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/copy"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"from": "uploads\/documents\/original.pdf",
"to": "uploads\/backup\/copy_of_original.pdf"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/copy';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'from' => 'uploads/documents/original.pdf',
'to' => 'uploads/backup/copy_of_original.pdf',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/copy'
payload = {
"from": "uploads\/documents\/original.pdf",
"to": "uploads\/backup\/copy_of_original.pdf"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "File copied successfully",
"data": {
"from": "uploads/documents/original.pdf",
"to": "uploads/backup/copy_of_original.pdf",
"copied_at": "2025-01-15T12:00:00.000000Z",
"original_size": 1024000,
"copy_size": 1024000
}
}
Example response (400, Copy failed):
{
"success": false,
"message": "File copy failed",
"errors": [
"Source file not found",
"Destination already exists"
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"from": [
"The from field is required."
],
"to": [
"The to field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get File Information
requires authentication
Retrieve detailed information about a specific file.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/files/info?path=uploads%2Fdocuments%2Fdocument.pdf" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"path\": \"architecto\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/info"
);
const params = {
"path": "uploads/documents/document.pdf",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"path": "architecto"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/info';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'path' => 'uploads/documents/document.pdf',
],
'json' => [
'path' => 'architecto',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/info'
payload = {
"path": "architecto"
}
params = {
'path': 'uploads/documents/document.pdf',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "File information retrieved successfully",
"data": {
"name": "document.pdf",
"path": "uploads/documents/document.pdf",
"size": 1024000,
"mime_type": "application/pdf",
"url": "https://example.com/storage/uploads/documents/document.pdf",
"created_at": "2025-01-15T10:00:00.000000Z",
"modified_at": "2025-01-15T10:00:00.000000Z",
"is_readable": true,
"is_writable": true,
"permissions": "0644"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, File not found):
{
"success": false,
"message": "File not found",
"errors": [
"The specified file does not exist"
]
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"path": [
"The path field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Service Configuration
requires authentication
Retrieve the current configuration settings for the file transfer service.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/files/config" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/config"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/config';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/config'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Configuration retrieved successfully",
"data": {
"allowed_mime_types": [
"application/pdf",
"image/jpeg",
"image/png",
"text/plain"
],
"max_file_size": 10485760,
"storage_driver": "local",
"base_directory": "storage/app/public",
"url_prefix": "storage"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update Service Configuration
requires authentication
Update the configuration settings for the file transfer service.
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/files/config" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"allowed_mime_types\": [
\"application\\/pdf\",
\"image\\/jpeg\",
\"image\\/png\"
],
\"max_file_size\": 10485760
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/files/config"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"allowed_mime_types": [
"application\/pdf",
"image\/jpeg",
"image\/png"
],
"max_file_size": 10485760
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/files/config';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'allowed_mime_types' => [
'application/pdf',
'image/jpeg',
'image/png',
],
'max_file_size' => 10485760,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/files/config'
payload = {
"allowed_mime_types": [
"application\/pdf",
"image\/jpeg",
"image\/png"
],
"max_file_size": 10485760
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Configuration updated successfully",
"data": {
"allowed_mime_types": [
"application/pdf",
"image/jpeg",
"image/png"
],
"max_file_size": 10485760,
"storage_driver": "local",
"base_directory": "storage/app/public",
"url_prefix": "storage",
"updated_at": "2025-01-15T12:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation error):
{
"success": false,
"message": "Validation failed",
"errors": {
"max_file_size": [
"The max file size must be between 1024 and 104857600."
],
"allowed_mime_types.0": [
"The allowed mime types.0 must be a string."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Fuel Management
Get all fuel records.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/fuels?search=Petronas&user_id=1&fuel_type=Petrol&date_from=2025-01-01&date_to=2025-01-31&fuelFilter=fuel-desc&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuels"
);
const params = {
"search": "Petronas",
"user_id": "1",
"fuel_type": "Petrol",
"date_from": "2025-01-01",
"date_to": "2025-01-31",
"fuelFilter": "fuel-desc",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuels';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'Petronas',
'user_id' => '1',
'fuel_type' => 'Petrol',
'date_from' => '2025-01-01',
'date_to' => '2025-01-31',
'fuelFilter' => 'fuel-desc',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuels'
params = {
'search': 'Petronas',
'user_id': '1',
'fuel_type': 'Petrol',
'date_from': '2025-01-01',
'date_to': '2025-01-31',
'fuelFilter': 'fuel-desc',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel records retrieved successfully",
"data": [
{
"id": 1,
"supplier_name": "Petronas",
"fuel_bought": "50.00",
"date_bought": "2025-01-01",
"user_id": 1,
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created fuel record.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/fuels" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"supplier_name\": \"Petronas\",
\"fuel_bought\": 50,
\"fuel_type\": \"Petrol\",
\"date_bought\": \"2025-01-01\",
\"user_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuels"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"supplier_name": "Petronas",
"fuel_bought": 50,
"fuel_type": "Petrol",
"date_bought": "2025-01-01",
"user_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuels';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'supplier_name' => 'Petronas',
'fuel_bought' => 50.0,
'fuel_type' => 'Petrol',
'date_bought' => '2025-01-01',
'user_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuels'
payload = {
"supplier_name": "Petronas",
"fuel_bought": 50,
"fuel_type": "Petrol",
"date_bought": "2025-01-01",
"user_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Fuel record created successfully",
"data": {
"id": 1,
"supplier_name": "Petronas",
"fuel_bought": "50.00",
"date_bought": "2025-01-01",
"user_id": 1,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specified fuel record.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/fuels/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuels/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuels/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuels/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel record retrieved successfully",
"data": {
"id": 1,
"supplier_name": "Petronas",
"fuel_bought": "50.00",
"date_bought": "2025-01-01",
"user_id": 1,
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified fuel record.
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/fuels/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"supplier_name\": \"Petronas\",
\"fuel_bought\": 50,
\"fuel_type\": \"Petrol\",
\"date_bought\": \"2025-01-01\",
\"user_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuels/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"supplier_name": "Petronas",
"fuel_bought": 50,
"fuel_type": "Petrol",
"date_bought": "2025-01-01",
"user_id": 1
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuels/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'supplier_name' => 'Petronas',
'fuel_bought' => 50.0,
'fuel_type' => 'Petrol',
'date_bought' => '2025-01-01',
'user_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuels/16'
payload = {
"supplier_name": "Petronas",
"fuel_bought": 50,
"fuel_type": "Petrol",
"date_bought": "2025-01-01",
"user_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel record updated successfully",
"data": {
"id": 1,
"supplier_name": "Petronas",
"fuel_bought": "50.00",
"date_bought": "2025-01-01",
"user_id": 1,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the specified fuel record.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/fuels/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuels/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuels/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuels/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel record deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Fuel Usage Management
Get all fuel usage records.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/fuel-usages?search=vehicle+1&user_id=1&staff_id=1&vehicle_id=1&fuel_type=Petrol&date_from=2025-01-01&date_to=2025-01-31&usageFilter=date-asc&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuel-usages"
);
const params = {
"search": "vehicle 1",
"user_id": "1",
"staff_id": "1",
"vehicle_id": "1",
"fuel_type": "Petrol",
"date_from": "2025-01-01",
"date_to": "2025-01-31",
"usageFilter": "date-asc",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'vehicle 1',
'user_id' => '1',
'staff_id' => '1',
'vehicle_id' => '1',
'fuel_type' => 'Petrol',
'date_from' => '2025-01-01',
'date_to' => '2025-01-31',
'usageFilter' => 'date-asc',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages'
params = {
'search': 'vehicle 1',
'user_id': '1',
'staff_id': '1',
'vehicle_id': '1',
'fuel_type': 'Petrol',
'date_from': '2025-01-01',
'date_to': '2025-01-31',
'usageFilter': 'date-asc',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel usage records retrieved successfully",
"data": [
{
"id": 1,
"usage_quantity": "10.00",
"usage_date": "2025-01-01",
"usage_description": "Used in vehicle 1",
"user_id": 1,
"staff_id": null,
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"staff": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created fuel usage record.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/fuel-usages" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"usage_quantity\": 10,
\"fuel_type\": \"Petrol\",
\"usage_date\": \"2025-01-01\",
\"usage_description\": \"Used for field work\",
\"user_id\": 1,
\"staff_id\": 1,
\"vehicle_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuel-usages"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"usage_quantity": 10,
"fuel_type": "Petrol",
"usage_date": "2025-01-01",
"usage_description": "Used for field work",
"user_id": 1,
"staff_id": 1,
"vehicle_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'usage_quantity' => 10.0,
'fuel_type' => 'Petrol',
'usage_date' => '2025-01-01',
'usage_description' => 'Used for field work',
'user_id' => 1,
'staff_id' => 1,
'vehicle_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages'
payload = {
"usage_quantity": 10,
"fuel_type": "Petrol",
"usage_date": "2025-01-01",
"usage_description": "Used for field work",
"user_id": 1,
"staff_id": 1,
"vehicle_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Fuel usage record created successfully",
"data": {
"id": 1,
"usage_quantity": "10.00",
"usage_date": "2025-01-01",
"usage_description": "Used for field work",
"user_id": 1,
"staff_id": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specified fuel usage record.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/fuel-usages/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuel-usages/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel usage record retrieved successfully",
"data": {
"id": 1,
"usage_quantity": "10.00",
"usage_date": "2025-01-01",
"usage_description": "Used for field work",
"user_id": 1,
"staff_id": null,
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"staff": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified fuel usage record.
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/fuel-usages/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"usage_quantity\": 10,
\"usage_date\": \"2025-01-01\",
\"usage_description\": \"Used for field work\",
\"user_id\": 1,
\"staff_id\": 1,
\"vehicle_id\": 1,
\"fuel_type\": \"petrol\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuel-usages/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"usage_quantity": 10,
"usage_date": "2025-01-01",
"usage_description": "Used for field work",
"user_id": 1,
"staff_id": 1,
"vehicle_id": 1,
"fuel_type": "petrol"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'usage_quantity' => 10.0,
'usage_date' => '2025-01-01',
'usage_description' => 'Used for field work',
'user_id' => 1,
'staff_id' => 1,
'vehicle_id' => 1,
'fuel_type' => 'petrol',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages/16'
payload = {
"usage_quantity": 10,
"usage_date": "2025-01-01",
"usage_description": "Used for field work",
"user_id": 1,
"staff_id": 1,
"vehicle_id": 1,
"fuel_type": "petrol"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel usage record updated successfully",
"data": {
"id": 1,
"usage_quantity": "10.00",
"usage_date": "2025-01-01",
"usage_description": "Used for field work",
"user_id": 1,
"staff_id": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the specified fuel usage record.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/fuel-usages/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/fuel-usages/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/fuel-usages/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Fuel usage record deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Location Management
Get all locations accessible to the authenticated user.
requires authentication
Returns a list of locations based on the user's role:
- Managers: See locations with tasks that are in_progress, pending or rejected
- Checkers: See locations with tasks that are pending
The response includes the task count for each location filtered by the user's role.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/locations" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/locations"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/locations';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/locations'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Manager Success):
{
"success": true,
"data": [
{
"id": 1,
"name": "A01",
"taskCount": 3,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
},
{
"id": 2,
"name": "B02",
"taskCount": 1,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
]
}
Example response (200, Checker Success):
{
"success": true,
"data": [
{
"id": 1,
"name": "A01",
"taskCount": 2,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Invalid Role):
{
"success": false,
"message": "Access denied"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created location.
requires authentication
Creates a new location. Only admin users can create locations.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/locations" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"location_name\": \"D01\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/locations"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"location_name": "D01"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/locations';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'location_name' => 'D01',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/locations'
payload = {
"location_name": "D01"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Location created successfully",
"data": {
"id": 10,
"name": "D01",
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Access denied):
{
"success": false,
"message": "Access denied. Only admin users can create locations."
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"location_name": [
"The location name field is required.",
"The location name has already been taken."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get details of a specific location.
requires authentication
Returns detailed information about a single location if the user has access to it. Access is determined by the user's role and whether the location has relevant tasks:
- Managers: Can access locations with in_progress, pending or rejected tasks
- Checkers: Can access locations with pending tasks
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/locations/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/locations/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/locations/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/locations/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Manager Access):
{
"success": true,
"data": {
"id": 1,
"name": "A01",
"taskCount": 3,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (200, Checker Access):
{
"success": true,
"data": {
"id": 1,
"name": "A01",
"taskCount": 2,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Access denied):
{
"success": false,
"message": "No tasks found for this location"
}
Example response (404, Location not found):
{
"success": false,
"message": "Location not found or access denied"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified location.
requires authentication
Updates an existing location. Only admin users can update locations.
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/locations/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"location_name\": \"A01-UPDATED\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/locations/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"location_name": "A01-UPDATED"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/locations/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'location_name' => 'A01-UPDATED',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/locations/16'
payload = {
"location_name": "A01-UPDATED"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Location updated successfully",
"data": {
"id": 1,
"name": "A01-UPDATED",
"taskCount": 3,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-15 10:30:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Access denied):
{
"success": false,
"message": "Access denied. Only admin users can update locations."
}
Example response (404, Location not found):
{
"success": false,
"message": "Location not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"location_name": [
"The location name has already been taken."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Toggle the active status of the specified location.
requires authentication
Sets the location's is_active status to false (inactive). Only admin users can deactivate locations. This is a soft delete operation - the location is marked as inactive rather than being permanently deleted.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/locations/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/locations/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/locations/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/locations/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Location deactivated successfully",
"data": {
"id": 1,
"name": "A01",
"isActive": false,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-15 10:30:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Access denied):
{
"success": false,
"message": "Access denied. Only admin users can deactivate locations."
}
Example response (404, Location not found):
{
"success": false,
"message": "Location not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get tasks for a specific location.
requires authentication
Returns a paginated list of tasks for the specified location, filtered by user role:
- Managers: See tasks with status 'in_progress', 'pending' or 'rejected'
- Checkers: See tasks with status 'pending'
The response includes both location details and the paginated tasks list. Tasks are ordered by task_date in descending order (newest first).
Task Meta Structure: Each task includes worker-specific meta data based on task type:
- Manuring: fertilizer_type, fertilizer_amount
- Sanitation: sanitation_type (spraying: herbicide_amount, slashing: no additional meta)
- Harvesting: harvesting_type
- Pruning: pruning_type
- Planting: No meta data required
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/locations/16/tasks" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/locations/16/tasks"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/locations/16/tasks';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/locations/16/tasks'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Manager Success):
{
"success": true,
"data": {
"location": {
"id": 1,
"name": "A01",
"taskCount": 3,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
},
"tasks": [
{
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilizer Application",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "John Manager"
},
"submittedAt": null,
"workers": [
{
"id": 1,
"fullName": "Worker One",
"phone": "019-1234567"
}
],
"task_meta": [
{
"id": 1,
"task_id": 1,
"staff_id": 1,
"meta_key": "fertilizer_type",
"meta_value": "NPK",
"staff": {
"id": 1,
"staff_name": "Worker One",
"staff_id": 1
}
},
{
"id": 2,
"task_id": 1,
"staff_id": 1,
"meta_key": "fertilizer_amount",
"meta_value": "50",
"staff": {
"id": 1,
"staff_name": "Worker One",
"staff_id": 1
}
}
],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
]
},
"pagination": {
"current_page": 1,
"last_page": 1,
"per_page": 15,
"total": 1
}
}
Example response (200, Checker Success):
{
"success": true,
"data": {
"location": {
"id": 1,
"name": "A01",
"taskCount": 2,
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
},
"tasks": [
{
"id": 2,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Harvest Check",
"taskType": "harvesting",
"taskDate": "2025-01-16",
"taskStatus": "pending",
"createdBy": {
"id": 1,
"name": "John Manager"
},
"submittedAt": "2025-01-16T10:00:00.000000Z",
"workers": [
{
"id": 1,
"fullName": "Checker Worker",
"phone": "019-9999999"
}
],
"task_meta": [
{
"id": 5,
"task_id": 2,
"staff_id": 1,
"meta_key": "harvesting_type",
"meta_value": "normal harvesting",
"staff": {
"id": 1,
"staff_name": "Checker Worker",
"staff_id": 1
}
}
],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
]
},
"pagination": {
"current_page": 1,
"last_page": 1,
"per_page": 15,
"total": 1
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Access denied):
{
"success": false,
"message": "Location not found or access denied"
}
Example response (404, Location not found):
{
"success": false,
"message": "Location not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Overtime Management
Get all overtime records.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/overtimes?user_id=1&staff_id=1&status=approved&date_attendance_id=1&date_from=2025-01-01&date_to=2025-01-31&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/overtimes"
);
const params = {
"user_id": "1",
"staff_id": "1",
"status": "approved",
"date_attendance_id": "1",
"date_from": "2025-01-01",
"date_to": "2025-01-31",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/overtimes';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'user_id' => '1',
'staff_id' => '1',
'status' => 'approved',
'date_attendance_id' => '1',
'date_from' => '2025-01-01',
'date_to' => '2025-01-31',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/overtimes'
params = {
'user_id': '1',
'staff_id': '1',
'status': 'approved',
'date_attendance_id': '1',
'date_from': '2025-01-01',
'date_to': '2025-01-31',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Overtime records retrieved successfully",
"data": [
{
"id": 1,
"user_id": 1,
"staff_id": null,
"date_attendance_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "approved",
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"staff": null,
"date_attendance": {
"id": 1,
"date": "2025-01-01",
"status": "active"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created overtime record.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/overtimes" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date\": \"2025-01-01\",
\"user_id\": 1,
\"staff_id\": 1,
\"duration\": 120,
\"remark\": \"Overtime for project completion\",
\"status\": \"pending\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/overtimes"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date": "2025-01-01",
"user_id": 1,
"staff_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "pending"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/overtimes';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date' => '2025-01-01',
'user_id' => 1,
'staff_id' => 1,
'duration' => 120,
'remark' => 'Overtime for project completion',
'status' => 'pending',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/overtimes'
payload = {
"date": "2025-01-01",
"user_id": 1,
"staff_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "pending"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Overtime record created successfully",
"data": {
"id": 1,
"user_id": 1,
"staff_id": null,
"date_attendance_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "pending",
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"staff": null,
"date_attendance": {
"id": 1,
"date": "2025-01-01",
"status": "active"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Example response (422, Validation Error):
{
"success": false,
"message": "Validation Error",
"errors": {
"date": [
"The date field is required."
],
"duration": [
"The duration field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specified overtime record.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/overtimes/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/overtimes/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/overtimes/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/overtimes/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Overtime record retrieved successfully",
"data": {
"id": 1,
"user_id": 1,
"staff_id": null,
"date_attendance_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "approved",
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"staff": null,
"date_attendance": {
"id": 1,
"date": "2025-01-01",
"status": "active"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified overtime record.
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/overtimes/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date\": \"2025-01-01\",
\"user_id\": 1,
\"staff_id\": 1,
\"duration\": 120,
\"remark\": \"Overtime for project completion\",
\"status\": \"approved\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/overtimes/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date": "2025-01-01",
"user_id": 1,
"staff_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "approved"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/overtimes/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date' => '2025-01-01',
'user_id' => 1,
'staff_id' => 1,
'duration' => 120,
'remark' => 'Overtime for project completion',
'status' => 'approved',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/overtimes/16'
payload = {
"date": "2025-01-01",
"user_id": 1,
"staff_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "approved"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Overtime record updated successfully",
"data": {
"id": 1,
"user_id": 1,
"staff_id": null,
"date_attendance_id": 1,
"duration": 120,
"remark": "Overtime for project completion",
"status": "approved",
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"staff": null,
"date_attendance": {
"id": 1,
"date": "2025-01-01",
"status": "active"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Example response (422, Validation Error):
{
"success": false,
"message": "Validation Error",
"errors": {
"duration": [
"The duration must be at least 1."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the specified overtime record.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/overtimes/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/overtimes/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/overtimes/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/overtimes/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Overtime record deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Payment Rate Management
APIs for managing payment rates for different task types
Get all payment rates
requires authentication
Retrieve all payment rates with their categories.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payment-rates" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payment-rates"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payment-rates';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payment-rates'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"data": [
{
"id": 1,
"task_name": "Pruning",
"task_type": "pruning",
"description": "Pruning palm trees",
"is_active": true,
"categories": [
{
"id": 1,
"category_name": "Normal Pruning",
"category_key": "normal",
"rate": "4.00",
"unit": "per palm",
"conditions": null,
"display_order": 0
}
]
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create a new payment rate
requires authentication
Create a new payment rate with optional categories. Categories can be added later via the update endpoint.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/payment-rates" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"task_name\": \"Pruning\",
\"task_type\": \"pruning\",
\"description\": \"Eius et animi quos velit et.\",
\"is_active\": true,
\"categories\": [
{
\"category_name\": \"Normal\",
\"category_key\": \"normal\",
\"rate\": 4,
\"unit\": \"per palm\"
}
]
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payment-rates"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"task_name": "Pruning",
"task_type": "pruning",
"description": "Eius et animi quos velit et.",
"is_active": true,
"categories": [
{
"category_name": "Normal",
"category_key": "normal",
"rate": 4,
"unit": "per palm"
}
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payment-rates';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
$o = [
clone (\Symfony\Component\VarExporter\Internal\Registry::$prototypes['stdClass'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('stdClass')),
],
null,
[
'stdClass' => [
'category_name' => [
'Normal',
],
'category_key' => [
'normal',
],
'rate' => [
4.0,
],
'unit' => [
'per palm',
],
],
],
[
'task_name' => 'Pruning',
'task_type' => 'pruning',
'description' => 'Eius et animi quos velit et.',
'is_active' => true,
'categories' => [
$o[0],
],
],
[]
),
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payment-rates'
payload = {
"task_name": "Pruning",
"task_type": "pruning",
"description": "Eius et animi quos velit et.",
"is_active": true,
"categories": [
{
"category_name": "Normal",
"category_key": "normal",
"rate": 4,
"unit": "per palm"
}
]
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Payment rate created successfully.",
"data": {
"id": 1,
"task_name": "Pruning",
"task_type": "pruning",
"categories": []
}
}
Example response (422, Validation Error):
{
"success": false,
"message": "Validation failed.",
"errors": {
"task_name": [
"The task name field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get payment rate by task type
requires authentication
Retrieve payment rate information for a specific task type. This is useful when creating/editing tasks to show available rates.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payment-rates/task-type/pruning" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payment-rates/task-type/pruning"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/task-type/pruning';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/task-type/pruning'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"id": 1,
"task_name": "Pruning",
"task_type": "pruning",
"categories": []
}
}
Example response (404, Not Found):
{
"success": false,
"message": "Payment rate not found for this task type."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get a single payment rate
requires authentication
Retrieve a specific payment rate with its categories.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payment-rates/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payment-rates/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"id": 1,
"task_name": "Pruning",
"task_type": "pruning",
"description": "Pruning palm trees",
"is_active": true,
"categories": [
{
"id": 1,
"category_name": "Normal Pruning",
"category_key": "normal",
"rate": "4.00",
"unit": "per palm"
}
]
}
}
Example response (404, Not Found):
{
"success": false,
"message": "Payment rate not found."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update a payment rate
requires authentication
Update an existing payment rate and its categories.
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/payment-rates/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"task_name\": \"Pruning\",
\"description\": \"Eius et animi quos velit et.\",
\"is_active\": true,
\"categories\": [
{
\"id\": 1,
\"rate\": 5
}
]
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payment-rates/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"task_name": "Pruning",
"description": "Eius et animi quos velit et.",
"is_active": true,
"categories": [
{
"id": 1,
"rate": 5
}
]
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
$o = [
clone (\Symfony\Component\VarExporter\Internal\Registry::$prototypes['stdClass'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('stdClass')),
],
null,
[
'stdClass' => [
'id' => [
1,
],
'rate' => [
5.0,
],
],
],
[
'task_name' => 'Pruning',
'description' => 'Eius et animi quos velit et.',
'is_active' => true,
'categories' => [
$o[0],
],
],
[]
),
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1'
payload = {
"task_name": "Pruning",
"description": "Eius et animi quos velit et.",
"is_active": true,
"categories": [
{
"id": 1,
"rate": 5
}
]
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Payment rate updated successfully.",
"data": {}
}
Example response (404, Not Found):
{
"success": false,
"message": "Payment rate not found."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a payment rate
requires authentication
Delete a payment rate and all its categories.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/payment-rates/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payment-rates/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Payment rate deleted successfully."
}
Example response (404, Not Found):
{
"success": false,
"message": "Payment rate not found."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a payment rate category
requires authentication
Delete a specific category from a payment rate.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/payment-rates/1/categories/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payment-rates/1/categories/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1/categories/1';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payment-rates/1/categories/1'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Category deleted successfully."
}
Example response (404, Not Found):
{
"success": false,
"message": "Category not found."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Salary Management
Get the current base salary for the given user.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/users/16/base-salary" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users/16/base-salary"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users/16/base-salary';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users/16/base-salary'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"user_id": 5,
"base_salary": 1800,
"updated_at": "2025-11-04 10:00:00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create or update the base salary for the given user.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/users/16/base-salary" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"base_salary\": 2000
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users/16/base-salary"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"base_salary": 2000
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users/16/base-salary';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'base_salary' => 2000.0,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users/16/base-salary'
payload = {
"base_salary": 2000
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Saved):
{
"message": "Base salary saved",
"user_id": 5,
"base_salary": 2000,
"updated_at": "2025-11-04 10:15:00"
}
Example response (422, Validation error):
{
"message": "The base salary field is required."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the base salary for the given user.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/users/16/base-salary" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users/16/base-salary"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users/16/base-salary';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users/16/base-salary'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Removed):
{
"message": "Base salary removed",
"user_id": 5
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Staff Attendance
Get Staff Attendance Records
requires authentication
Retrieve a paginated list of staff attendance records for a specific date attendance. This endpoint returns all staff members with their attendance status (Absent, Check in, or Present) for the specified date attendance ID.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff-attendance?date_attendance_id=1&page=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 16,
\"page\": 22,
\"per_page\": 7
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance"
);
const params = {
"date_attendance_id": "1",
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 16,
"page": 22,
"per_page": 7
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'date_attendance_id' => '1',
'page' => '1',
'per_page' => '10',
],
'json' => [
'date_attendance_id' => 16,
'page' => 22,
'per_page' => 7,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance'
payload = {
"date_attendance_id": 16,
"page": 22,
"per_page": 7
}
params = {
'date_attendance_id': '1',
'page': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff attendance retrieved successfully",
"data": {
"data": [
{
"staff_id": 1,
"staff_img": "staff_avatar.jpg",
"staff_name": "John Doe",
"status": "Present",
"check_in": "2025-01-15 08:00:00",
"check_out": "2025-01-15 17:00:00",
"checkedin_by": "Admin User",
"checkedout_by": "Admin User"
},
{
"staff_id": 2,
"staff_img": "staff_avatar2.jpg",
"staff_name": "Jane Smith",
"status": "Check_in",
"check_in": "2025-01-15 08:30:00",
"check_out": null,
"checkedin_by": "Manager User",
"checkedout_by": null
},
{
"staff_id": 3,
"staff_img": "staff_avatar3.jpg",
"staff_name": "Mike Johnson",
"status": "Absent",
"check_in": null,
"check_out": null,
"checkedin_by": null,
"checkedout_by": null
}
],
"current_page": 1,
"per_page": 15,
"total": 50,
"last_page": 4,
"from": 1,
"to": 15
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"date_attendance_id": [
"The date attendance id field is required."
],
"page": [
"The page field must be at least 1."
],
"per_page": [
"The per page field must not be greater than 100."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Show Staff Attendance Analytics
requires authentication
Retrieve the analytics of a staff attendance record. This endpoint returns the analytics of the attendance record for the staff ID.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff-attendance/1/analytics?month=2025-01" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/1/analytics"
);
const params = {
"month": "2025-01",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1/analytics';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '2025-01',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1/analytics'
params = {
'month': '2025-01',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff attendance retrieved successfully",
"data": {
"staff_id": 1,
"attendance_rate": 90,
"punctuality_rate": "90,
"number_absent": 1
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record staff attendance"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Specific Staff Attendance Records
requires authentication
Retrieve the details of a specific staff attendance record. This endpoint returns the attendance record for the specified staff ID and month.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff-attendance/1/records?month=2025-01&status=present%2C+check_in%2C+check_out%2C+absent&page=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/1/records"
);
const params = {
"month": "2025-01",
"status": "present, check_in, check_out, absent",
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1/records';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '2025-01',
'status' => 'present, check_in, check_out, absent',
'page' => '1',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1/records'
params = {
'month': '2025-01',
'status': 'present, check_in, check_out, absent',
'page': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff attendance retrieved successfully",
"data": {
"data": [
{
"id": 1,
"date": "19-01-2025",
"status": "Present",
"checkedin_by": "Admin User",
"checkedout_by": "Admin User",
"check_in": "2025-01-19 07:30:00",
"check_out": "2025-01-19 17:00:00",
"duration": 34200,
"remark_late": null,
"notes": null
},
{
"id": 2,
"date": "20-01-2025",
"status": "Check_in",
"checkedin_by": "Manager User",
"checkedout_by": null,
"check_in": "2025-01-20 08:00:00",
"check_out": null,
"duration": null,
"remark_late": "Traffic jam",
"notes": null
},
{
"id": 3,
"date": "21-01-2025",
"status": "Absent",
"checkedin_by": null,
"checkedout_by": null,
"check_in": null,
"check_out": null,
"duration": null,
"remark_late": null,
"notes": null
}
],
"current_page": 1,
"per_page": 15,
"total": 50,
"last_page": 4,
"from": 1,
"to": 15
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Not Found):
{
"success": false,
"message": "Staff member not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"staff_id": [
"The staff id field is required."
],
"month": [
"The month field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Staff Leave Records
requires authentication
Retrieve a paginated list of staff leave attendance records. This endpoint returns only leave types (sick_leave, annual_leave, unpaid_leave).
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff-attendance/1/leaves?month=2025-01&status=%22sick_leave%22&page=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/1/leaves"
);
const params = {
"month": "2025-01",
"status": ""sick_leave"",
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1/leaves';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '2025-01',
'status' => '"sick_leave"',
'page' => '1',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1/leaves'
params = {
'month': '2025-01',
'status': '"sick_leave"',
'page': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff leave records retrieved successfully",
"data": {
"data": [
{
"id": 1,
"date": "24-10-2025",
"type_of_leave": "Annual Leave",
"created_by": "Admin User",
"created_at": "2025-10-24T08:00:00.000000Z",
"start_date": "24-10-2025",
"end_date": "24-10-2025",
"remarks": "Going back to hometown: Family passed away"
},
{
"id": 2,
"date": "25-10-2025",
"type_of_leave": "Sick Leave",
"created_by": "Manager User",
"created_at": "2025-10-25T08:00:00.000000Z",
"start_date": "25-10-2025",
"end_date": "25-10-2025",
"remarks": "Medical appointment"
}
],
"current_page": 1,
"per_page": 15,
"total": 50,
"last_page": 4,
"from": 1,
"to": 15
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Not Found):
{
"success": false,
"message": "Staff member not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"month": [
"The month must be in Y-m format (e.g., 2025-01)"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check In Staff
requires authentication
Record staff check-in time with offline sync support. This endpoint handles duplicate submissions intelligently by always saving the earliest time.
Offline Sync Logic:
- Always saves the earliest check-in time submitted
- Updates remarks when check-in time is updated
- Preserves existing check-out data and recalculates duration
- Maintains checker information for audit trail
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff-attendance/check-in" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 1,
\"staff_id\": 1,
\"check_in\": \"2025-01-15 08:00:00\",
\"remark_late\": \"\\\"Traffic jam\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/check-in"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 1,
"staff_id": 1,
"check_in": "2025-01-15 08:00:00",
"remark_late": "\"Traffic jam\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/check-in';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date_attendance_id' => 1,
'staff_id' => 1,
'check_in' => '2025-01-15 08:00:00',
'remark_late' => '"Traffic jam"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/check-in'
payload = {
"date_attendance_id": 1,
"staff_id": 1,
"check_in": "2025-01-15 08:00:00",
"remark_late": "\"Traffic jam\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, New Check-in Record):
{
"success": true,
"message": "Staff checked in successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 08:00:00",
"check_out": null,
"status": "check_in",
"duration": null,
"remark_late": "Traffic jam",
"notes": null,
"checkedin_by": 2,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, Updated Check-in Time):
{
"success": true,
"message": "Staff check-in updated successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 07:30:00",
"check_out": "2025-01-15 17:00:00",
"status": "present",
"duration": 34200,
"remark_late": "Early arrival",
"notes": null,
"checkedin_by": 3,
"checkedout_by": 2,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T07:30:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record staff attendance"
}
Example response (422, Validation Error):
{
"success": false,
"message": "Validation Error",
"errors": {
"check_in": [
"The check in field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check Out Staff
requires authentication
Record staff check-out time with offline sync support. This endpoint handles duplicate submissions intelligently by always saving the latest time.
Offline Sync Logic:
- Always saves the latest check-out time submitted
- Requires existing check-in before allowing check-out
- Automatically calculates duration when both times exist
- Maintains checker information for audit trail
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff-attendance/check-out" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 1,
\"staff_id\": 1,
\"check_out\": \"2025-01-15 17:00:00\",
\"notes\": \"architecto\",
\"remark_ot\": \"\\\"Extra work required\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/check-out"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 1,
"staff_id": 1,
"check_out": "2025-01-15 17:00:00",
"notes": "architecto",
"remark_ot": "\"Extra work required\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/check-out';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date_attendance_id' => 1,
'staff_id' => 1,
'check_out' => '2025-01-15 17:00:00',
'notes' => 'architecto',
'remark_ot' => '"Extra work required"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/check-out'
payload = {
"date_attendance_id": 1,
"staff_id": 1,
"check_out": "2025-01-15 17:00:00",
"notes": "architecto",
"remark_ot": "\"Extra work required\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, New Check-out Record):
{
"success": true,
"message": "Staff checked out successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 08:00:00",
"check_out": "2025-01-15 17:00:00",
"status": "present",
"duration": 32400,
"remark_late": null,
"notes": "Extra work required",
"checkedin_by": 2,
"checkedout_by": 2,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T17:00:00.000000Z"
}
}
Example response (201, Updated Check-out Time):
{
"success": true,
"message": "Staff check-out updated successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 08:00:00",
"check_out": "2025-01-15 18:00:00",
"status": "present",
"duration": 36000,
"remark_late": null,
"notes": "Extended hours",
"checkedin_by": 2,
"checkedout_by": 3,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T18:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record staff attendance"
}
Example response (422, No Check-in Found):
{
"success": false,
"message": "Validation Error",
"errors": {
"check_out": [
"Staff must check in before checking out"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Mark Staff as Absent
requires authentication
Mark staff as absent for a specific date attendance. This will clear any existing check-in/out times and set status to absent. If staff has already checked in, the request will be ignored.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-absent" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 1,
\"staff_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-absent"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 1,
"staff_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-absent';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date_attendance_id' => 1,
'staff_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-absent'
payload = {
"date_attendance_id": 1,
"staff_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Staff Already Present):
{
"success": true,
"message": "Staff is already present, absent request ignored",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15T08:00:00.000000Z",
"check_out": null,
"status": "check_in",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": 2,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, Staff Marked Absent):
{
"success": true,
"message": "Staff marked as absent successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "absent",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": null,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record staff attendance"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Mark Staff as Leave
requires authentication
Mark staff as leave (sick leave or annual leave) for a specific date attendance. This will clear any existing check-in/out times and set status to the specified leave type. If staff has already checked in, the request will be ignored.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-leave" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"staff_id\": 1,
\"from_date\": \"2025-01-01\",
\"to_date\": \"2025-01-01\",
\"status\": \"\\\"sick_leave\\\"\",
\"notes\": \"\\\"Sick leave for 1 day\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-leave"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"staff_id": 1,
"from_date": "2025-01-01",
"to_date": "2025-01-01",
"status": "\"sick_leave\"",
"notes": "\"Sick leave for 1 day\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-leave';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'staff_id' => 1,
'from_date' => '2025-01-01',
'to_date' => '2025-01-01',
'status' => '"sick_leave"',
'notes' => '"Sick leave for 1 day"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/mark-leave'
payload = {
"staff_id": 1,
"from_date": "2025-01-01",
"to_date": "2025-01-01",
"status": "\"sick_leave\"",
"notes": "\"Sick leave for 1 day\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Staff Already Present):
{
"success": true,
"message": "Staff is already present, leave request ignored",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15T08:00:00.000000Z",
"check_out": null,
"status": "check_in",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": 2,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, Staff Marked Sick Leave):
{
"success": true,
"message": "Staff marked as sick leave successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "sick_leave",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": null,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, Staff Marked Annual Leave):
{
"success": true,
"message": "Staff marked as annual leave successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "annual_leave",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": null,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record staff attendance"
}
Example response (422, Validation Error):
{
"success": false,
"message": "Validation Error",
"errors": {
"status": [
"The selected status is invalid."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update Staff Leave Attendance
requires authentication
Update a staff leave attendance record. Only leave types (sick_leave, annual_leave, unpaid_leave) can be updated.
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/staff-attendance/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"status\": \"\\\"sick_leave\\\"\",
\"notes\": \"\\\"Updated sick leave notes\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "\"sick_leave\"",
"notes": "\"Updated sick leave notes\""
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'status' => '"sick_leave"',
'notes' => '"Updated sick leave notes"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1'
payload = {
"status": "\"sick_leave\"",
"notes": "\"Updated sick leave notes\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff leave attendance updated successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "sick_leave",
"duration": null,
"remark_late": null,
"notes": "Updated sick leave notes",
"checkedin_by": 2,
"checkedout_by": 2,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T09:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record staff attendance"
}
Example response (404, Not Found):
{
"success": false,
"message": "Attendance record not found"
}
Example response (422, Not a Leave Type):
{
"success": false,
"message": "Only leave attendance records can be updated"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete Staff Leave Attendance
requires authentication
Soft delete a staff leave attendance record. Only leave types (sick_leave, annual_leave, unpaid_leave) can be deleted.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/staff-attendance/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/1'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff leave attendance deleted successfully",
"data": {
"id": 1,
"staff_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "sick_leave",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": 2,
"checkedout_by": 2,
"deleted_at": "2025-01-15T09:00:00.000000Z",
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T09:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record staff attendance"
}
Example response (404, Not Found):
{
"success": false,
"message": "Attendance record not found"
}
Example response (422, Not a Leave Type):
{
"success": false,
"message": "Only leave attendance records can be deleted"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Mark All attendance that is not checked out yet to be checked out
requires authentication
Mark staff attendance that is not checked out yet to set the checkout time. Checkout time will be set to 4pm on the same date as check-in. Should be done with cron job every 7 PM. Only for staff attendance that is not checked out yet. Processes all attendance records (not just today).
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff-attendance/auto-checkout" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff-attendance/auto-checkout"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/auto-checkout';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff-attendance/auto-checkout'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()Example response (200, All attendance that is not checked out yet to be checked out):
{
"success": true,
"message": "All attendance that is not checked out yet to be checked out",
"data": {
"count": 10
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Staff Management
Display a listing of the staff.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff?search=john&gender=male&claimed=&per_page=10&page=1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff"
);
const params = {
"search": "john",
"gender": "male",
"claimed": "0",
"per_page": "10",
"page": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'john',
'gender' => 'male',
'claimed' => '0',
'per_page' => '10',
'page' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff'
params = {
'search': 'john',
'gender': 'male',
'claimed': '0',
'per_page': '10',
'page': '1',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff list retrieved successfully",
"data": [
{
"id": 1,
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": "https://example.com/staff.jpg",
"staff_doc": null,
"staff_gender": "male",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2024-01-15",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z",
"claimed_staff": {
"claimedStaff_id": 1,
"staff_id": 1,
"user_id": 2,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z",
"user": {
"id": 2,
"user_fullname": "Manager Name"
}
}
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Register Staff
requires authentication
Register a new staff member.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff/register" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"staff_fullname\": \"John Doe\",
\"staff_phone\": \"+1234567890\",
\"staff_dob\": \"1990-01-01\",
\"staff_gender\": \"male\",
\"staff_doc\": \"https:\\/\\/example.com\\/doc.pdf\",
\"staff_bank_name\": \"Maybank\",
\"staff_bank_number\": \"1234567890\",
\"staff_kwsp_number\": \"1234567890\",
\"staff_employment_start_date\": \"2024-01-15\",
\"staff_img\": \"https:\\/\\/example.com\\/image.jpg\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/register"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_gender": "male",
"staff_doc": "https:\/\/example.com\/doc.pdf",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2024-01-15",
"staff_img": "https:\/\/example.com\/image.jpg"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/register';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'staff_fullname' => 'John Doe',
'staff_phone' => '+1234567890',
'staff_dob' => '1990-01-01',
'staff_gender' => 'male',
'staff_doc' => 'https://example.com/doc.pdf',
'staff_bank_name' => 'Maybank',
'staff_bank_number' => '1234567890',
'staff_kwsp_number' => '1234567890',
'staff_employment_start_date' => '2024-01-15',
'staff_img' => 'https://example.com/image.jpg',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/register'
payload = {
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_gender": "male",
"staff_doc": "https:\/\/example.com\/doc.pdf",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2024-01-15",
"staff_img": "https:\/\/example.com\/image.jpg"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Successful registration):
{
"success": true,
"message": "Staff registered successfully",
"data": {
"id": 1,
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": null,
"staff_doc": null,
"staff_gender": "male",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2024-01-15",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"staff_fullname": [
"The staff fullname field is required."
],
"staff_phone": [
"The staff phone field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get list of staff members assigned to a manager.
requires authentication
- Managers: Can only view their own assigned staff (read-only). No parameters needed.
- Admins: Can view any manager's assigned staff by providing user_id query parameter.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff/my-staff?user_id=2" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/my-staff"
);
const params = {
"user_id": "2",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/my-staff';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'user_id' => '2',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/my-staff'
params = {
'user_id': '2',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success - Manager viewing own staff):
{
"success": true,
"message": "Assigned staff retrieved successfully",
"data": [
{
"id": 1,
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": "https://example.com/staff.jpg",
"staff_doc": null,
"staff_gender": "male",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2024-01-15",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
]
}
Example response (200, Success - Admin viewing manager's staff):
{
"success": true,
"message": "Manager's assigned staff retrieved successfully",
"data": {
"manager": {
"id": 2,
"user_fullname": "Manager Name",
"user_nickname": "manager1",
"user_role": "manager",
"user_img": null
},
"staff": [
{
"id": 1,
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": "https://example.com/staff.jpg",
"staff_doc": null,
"staff_gender": "male",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
]
}
}
Example response (400, Not a manager):
{
"success": false,
"message": "The specified user is not a manager"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden - Manager trying to view other manager's staff):
{
"success": false,
"message": "Only admins can view other manager's assigned staff"
}
Example response (404, User not found):
{
"success": false,
"message": "User not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Assign a staff member to a manager (Admin only).
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff/claim" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"staff_id\": 1,
\"user_id\": 2
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/claim"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"staff_id": 1,
"user_id": 2
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/claim';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'staff_id' => 1,
'user_id' => 2,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/claim'
payload = {
"staff_id": 1,
"user_id": 2
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff assigned to manager successfully",
"data": {
"claimedStaff_id": 1,
"staff_id": 1,
"user_id": 2,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Example response (400, Staff already claimed):
{
"success": false,
"message": "This staff member is already assigned to another manager"
}
Example response (400, Not a manager):
{
"success": false,
"message": "The specified user is not a manager"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden - Not Admin):
{
"success": false,
"message": "Only admins can assign staff to managers"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Unassign a staff member from their manager (Admin only).
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/staff/16/unclaim" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16/unclaim"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16/unclaim';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16/unclaim'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff unassigned successfully"
}
Example response (400, Staff not assigned):
{
"success": false,
"message": "This staff member is not assigned to any manager"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden - Not Admin):
{
"success": false,
"message": "Only admins can unassign staff from managers"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update staff status (Admin only).
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/staff/16/status" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"staff_status\": \"inactive\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16/status"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"staff_status": "inactive"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16/status';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'staff_status' => 'inactive',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16/status'
payload = {
"staff_status": "inactive"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff status updated successfully",
"data": {
"id": 1,
"staff_fullname": "John Doe",
"staff_status": "inactive",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden - Not Admin):
{
"success": false,
"message": "Only admins can update staff status"
}
Example response (404, Staff not found):
{
"success": false,
"message": "Staff not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"staff_status": [
"The selected staff status is invalid."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specific staff.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff details retrieved successfully",
"data": {
"id": 1,
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": "https://example.com/staff.jpg",
"staff_doc": null,
"staff_gender": "male",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z",
"attendance_count_month": 15,
"claimed_staff": {
"claimedStaff_id": 1,
"staff_id": 1,
"user_id": 2,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z",
"user": {
"id": 2,
"user_fullname": "Manager Name",
"user_nickname": "manager1"
}
}
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Staff not found):
{
"success": false,
"message": "Staff not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update staff details.
requires authentication
Update an existing staff member's information.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"staff_fullname\": \"John Doe\",
\"staff_phone\": \"+1234567890\",
\"staff_dob\": \"1990-01-01\",
\"staff_gender\": \"male\",
\"staff_doc\": \"https:\\/\\/example.com\\/doc.pdf\",
\"staff_bank_name\": \"Maybank\",
\"staff_bank_number\": \"1234567890\",
\"staff_kwsp_number\": \"1234567890\",
\"staff_employment_start_date\": \"2026-01-12T11:56:41\",
\"staff_img\": \"https:\\/\\/example.com\\/image.jpg\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_gender": "male",
"staff_doc": "https:\/\/example.com\/doc.pdf",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2026-01-12T11:56:41",
"staff_img": "https:\/\/example.com\/image.jpg"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'staff_fullname' => 'John Doe',
'staff_phone' => '+1234567890',
'staff_dob' => '1990-01-01',
'staff_gender' => 'male',
'staff_doc' => 'https://example.com/doc.pdf',
'staff_bank_name' => 'Maybank',
'staff_bank_number' => '1234567890',
'staff_kwsp_number' => '1234567890',
'staff_employment_start_date' => '2026-01-12T11:56:41',
'staff_img' => 'https://example.com/image.jpg',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16'
payload = {
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_gender": "male",
"staff_doc": "https:\/\/example.com\/doc.pdf",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2026-01-12T11:56:41",
"staff_img": "https:\/\/example.com\/image.jpg"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Successful update):
{
"success": true,
"message": "Staff details updated successfully",
"data": {
"id": 1,
"staff_fullname": "John Doe Updated",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": "https://example.com/staff-updated.jpg",
"staff_doc": null,
"staff_gender": "male",
"staff_bank_name": "Maybank",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "1234567890",
"staff_employment_start_date": "2024-01-15",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Staff not found):
{
"success": false,
"message": "Staff not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"staff_gender": [
"The selected staff gender is invalid."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a staff member.
requires authentication
Permanently delete a staff member from the system. Only admins can delete staff. This will also delete related records such as claimed staff assignments and task worker assignments.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/staff/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff deleted successfully"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden - Not Admin):
{
"success": false,
"message": "Only admins can delete staff members"
}
Example response (404, Staff not found):
{
"success": false,
"message": "Staff not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Staff Payroll Management
Get list of staff with their payroll information for manage payroll page.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payroll/staff?search=john" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/staff"
);
const params = {
"search": "john",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'john',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff'
params = {
'search': 'john',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Staff list retrieved successfully",
"data": [
{
"id": 1,
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": null,
"age": 35,
"staff_employment_start_date": "2024-01-15",
"joined_since": "2024",
"payslips_count": 5
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get employment overview with payslip history for a specific staff member.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payroll/staff/16/overview" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/staff/16/overview"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/16/overview';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/16/overview'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Data retrieved successfully",
"data": {
"staff": {
"id": 1,
"staff_fullname": "John Doe",
"staff_phone": "+1234567890",
"staff_dob": "1990-01-01",
"staff_img": null,
"age": 35,
"staff_employment_start_date": "2024-01-15",
"joined_since": "2024"
},
"payslips": [
{
"id": 1,
"payslip_month": "October 2025",
"payslip_month_short": "10/25",
"total_income": 5000,
"total_deduction": 500,
"net_salary": 4500,
"created_at": "2025-11-01T10:30:00.000000Z"
}
]
}
}
Example response (404, Staff not found):
{
"success": false,
"message": "Staff not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Generate a new payslip for a staff member for a specific month.
requires authentication
Calculates total income from base salary and task earnings, applies deductions including manual deductions, attendance-based deductions (early out, lateness), and optional advance loan repayments.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/payroll/staff/16/generate" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"payslip_month\": \"10\\/25\",
\"deductions\": [
\"architecto\"
],
\"advance_repayment_amount\": \"500.00\",
\"advance_repayment_remarks\": \"Partial loan repayment\",
\"employer_epf\": 19,
\"employer_socso\": 17,
\"employer_eis\": 5,
\"employer_pcb\": 8
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/staff/16/generate"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"payslip_month": "10\/25",
"deductions": [
"architecto"
],
"advance_repayment_amount": "500.00",
"advance_repayment_remarks": "Partial loan repayment",
"employer_epf": 19,
"employer_socso": 17,
"employer_eis": 5,
"employer_pcb": 8
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/16/generate';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'payslip_month' => '10/25',
'deductions' => [
'architecto',
],
'advance_repayment_amount' => '500.00',
'advance_repayment_remarks' => 'Partial loan repayment',
'employer_epf' => 19,
'employer_socso' => 17,
'employer_eis' => 5,
'employer_pcb' => 8,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/16/generate'
payload = {
"payslip_month": "10\/25",
"deductions": [
"architecto"
],
"advance_repayment_amount": "500.00",
"advance_repayment_remarks": "Partial loan repayment",
"employer_epf": 19,
"employer_socso": 17,
"employer_eis": 5,
"employer_pcb": 8
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Payslip generated successfully",
"data": {
"id": 1,
"staff_id": 1,
"staff": {
"id": 1,
"staff_fullname": "John Doe",
"staff_doc": "DOC123",
"staff_bank_name": "Bank XYZ",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "KWSP123"
},
"payslip_month": "10/25",
"payslip_month_readable": "October 2025",
"base_salary": 3000,
"task_income": 2000,
"total_income": 5000,
"total_deduction": 600,
"net_salary": 4400,
"breakdown": {},
"deductions": [
{
"deduction_type": "Insurance",
"deduction_amount": 100,
"deduction_note": "Health insurance",
"source": "manual"
},
{
"deduction_type": "Early Out",
"deduction_amount": 50,
"deduction_note": "Early checkout 2 time(s), total 120 minutes",
"source": "calculated"
},
{
"deduction_type": "Advance Repayment",
"deduction_amount": 500,
"deduction_note": "Partial loan repayment",
"source": "advance_repayment"
}
],
"advance_repayment_requested": 500,
"advance_repayment_applied_total": 500,
"advance_repayment_applied": [],
"advance_outstanding_before": 1000,
"advance_outstanding_after": 500,
"attendance_deductions": {
"early_out": {
"count": 2,
"total_minutes": 120,
"amount": 50
},
"lateness": {
"count": 0,
"total_minutes": 0,
"amount": 0
},
"calculation_info": {}
}
}
}
Example response (404, Staff not found):
{
"success": false,
"message": "Staff not found"
}
Example response (422, Validation error):
{
"success": false,
"message": "Payslip for this month already exists"
}
Example response (500, Server error):
{
"success": false,
"message": "Failed to generate payslip: [error details]"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Retrieve details of a specific staff payslip.
requires authentication
Returns comprehensive payslip information including staff details, income breakdown, deductions, and net salary. Supports both JSON API response and HTML view rendering.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16?view=html" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16"
);
const params = {
"view": "html",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'view' => 'html',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16'
params = {
'view': 'html',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Payslip details retrieved successfully",
"data": {
"id": 1,
"staff": {
"id": 1,
"staff_fullname": "John Doe",
"staff_doc": "DOC123",
"staff_bank_name": "Bank XYZ",
"staff_bank_number": "1234567890",
"staff_kwsp_number": "KWSP123"
},
"payslip_month": "10/25",
"payslip_month_readable": "October 2025",
"base_salary": 3000,
"task_income": 2000,
"total_income": 5000,
"total_deduction": 500,
"net_salary": 4500,
"breakdown": {},
"deductions": [],
"created_at": "2025-11-01T10:30:00.000000Z"
}
}
Example response (404, Payslip not found):
{
"success": false,
"message": "Payslip not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a payslip.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/staff/payslips/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Payslip deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Staff Salary Management
Get the current base salary for the given staff member.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/staff/16/base-salary" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16/base-salary"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16/base-salary';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16/base-salary'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"staff_id": 5,
"base_salary": 1800,
"updated_at": "2025-11-04 10:00:00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create or update the base salary for the given staff member.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/staff/16/base-salary" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"base_salary\": 2000
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16/base-salary"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"base_salary": 2000
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16/base-salary';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'base_salary' => 2000.0,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16/base-salary'
payload = {
"base_salary": 2000
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Saved):
{
"message": "Base salary saved",
"staff_id": 5,
"base_salary": 2000,
"updated_at": "2025-11-04 10:15:00"
}
Example response (422, Validation error):
{
"message": "The base salary field is required."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the base salary for the given staff member.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/staff/16/base-salary" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/staff/16/base-salary"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/staff/16/base-salary';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/staff/16/base-salary'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Removed):
{
"message": "Base salary removed",
"staff_id": 5
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Task Audit
Get All Audited Tasks
requires authentication
Retrieve all audited tasks with their complete data including media files. Media files (video and images) are returned as accessible temporary URLs since they are stored in private storage.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tasks/audits?page=1&per_page=15&action=approve&task_id=1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/audits"
);
const params = {
"page": "1",
"per_page": "15",
"action": "approve",
"task_id": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'page' => '1',
'per_page' => '15',
'action' => 'approve',
'task_id' => '1',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits'
params = {
'page': '1',
'per_page': '15',
'action': 'approve',
'task_id': '1',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Audited tasks retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"task_id": 1,
"approved_by": 2,
"task_video": "https://example.com/temporary-url/video.mp4",
"task_img": [
"https://example.com/temporary-url/image1.png",
"https://example.com/temporary-url/image2.png"
],
"action": "approve",
"remarks": "Task completed successfully",
"created_at": "2025-01-15T10:00:00.000000Z",
"updated_at": "2025-01-15T10:00:00.000000Z",
"task": {
"id": 1,
"task_name": "Pruning Task",
"task_status": "completed"
},
"approved_by_user": {
"id": 2,
"user_fullname": "John Approver"
},
"worker_audit_meta": [
{
"id": 1,
"task_audit_id": 1,
"staff_id": 1,
"payment_rate_category_id": 12,
"meta_value": "10",
"staff": {
"id": 1,
"staff_fullname": "Jane Worker"
},
"payment_rate_category": {
"id": 12,
"category_name": "Normal Pruning"
}
}
]
}
],
"total": 50,
"per_page": 15,
"last_page": 4
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Task With Payment Rate Categories
requires authentication
Get a list of task categories with id and the category name. This endpoint is used to get the list of task categories for the task audit. Can also get the for specific task type.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tasks/audits/categories?task_type=%22pruning%22" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/audits/categories"
);
const params = {
"task_type": ""pruning"",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits/categories';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'task_type' => '"pruning"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits/categories'
params = {
'task_type': '"pruning"',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": [
{
"id": 1,
"category_name": "Normal Pruning"
},
{
"id": 2,
"category_name": "Routine Pruning"
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Reject Task
requires authentication
Reject a pending task and change its status to in_progress. This endpoint allows approvers to reject tasks that need to be redone.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tasks/audits/16/reject" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"remarks\": \"\\\"Task not completed properly\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/audits/16/reject"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"remarks": "\"Task not completed properly\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits/16/reject';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'remarks' => '"Task not completed properly"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits/16/reject'
payload = {
"remarks": "\"Task not completed properly\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Task rejected successfully",
"data": {
"id": 1,
"task_id": 1,
"approved_by": 2,
"task_video": null,
"task_img": null,
"action": "reject",
"remarks": "Task not completed properly",
"created_at": "2025-01-15T10:00:00.000000Z",
"updated_at": "2025-01-15T10:00:00.000000Z",
"task": {
"id": 1,
"task_name": "Pruning Task",
"task_status": "pending"
}
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to audit tasks"
}
Example response (404, Task Not Found):
{
"success": false,
"message": "Task not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"remarks": [
"The remarks field must be a string."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Approve Task
requires authentication
Approve a pending task and change its status to completed. This endpoint allows approvers to approve tasks with evidence (video and images).
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tasks/audits/16/approve" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"task_video\": \"\\\"https:\\/\\/example.com\\/video.mp4\\\"\",
\"task_img\": [
\"https:\\/\\/example.com\\/img1.jpg\",
\"https:\\/\\/example.com\\/img2.jpg\"
],
\"remarks\": \"\\\"Task completed successfully\\\"\",
\"worker_audit_meta\": null
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/audits/16/approve"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"task_video": "\"https:\/\/example.com\/video.mp4\"",
"task_img": [
"https:\/\/example.com\/img1.jpg",
"https:\/\/example.com\/img2.jpg"
],
"remarks": "\"Task completed successfully\"",
"worker_audit_meta": null
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits/16/approve';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'task_video' => '"https://example.com/video.mp4"',
'task_img' => [
'https://example.com/img1.jpg',
'https://example.com/img2.jpg',
],
'remarks' => '"Task completed successfully"',
'worker_audit_meta' => null,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/audits/16/approve'
payload = {
"task_video": "\"https:\/\/example.com\/video.mp4\"",
"task_img": [
"https:\/\/example.com\/img1.jpg",
"https:\/\/example.com\/img2.jpg"
],
"remarks": "\"Task completed successfully\"",
"worker_audit_meta": null
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Task approved successfully",
"data": {
"id": 1,
"task_id": 1,
"approved_by": 2,
"task_video": "https://example.com/video.mp4",
"task_img": [
"https://example.com/img1.jpg",
"https://example.com/img2.jpg"
],
"action": "approve",
"remarks": "Task completed successfully",
"created_at": "2025-01-15T10:00:00.000000Z",
"updated_at": "2025-01-15T10:00:00.000000Z",
"task": {
"id": 1,
"task_name": "Pruning Task",
"task_status": "completed"
},
"worker_audit_meta": [
{
"id": 1,
"task_audit_id": 1,
"staff_id": 1,
"payment_rate_category_id": 12,
"meta_value": "10",
"staff": {
"id": 1,
"staff_name": "Jane Worker"
}
},
{
"id": 2,
"task_audit_id": 1,
"staff_id": 1,
"payment_rate_category_id": 15,
"meta_value": "5000",
"staff": {
"id": 1,
"staff_name": "Jane Worker"
}
}
]
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to audit tasks"
}
Example response (404, Task Not Found):
{
"success": false,
"message": "Task not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"task_video": [
"The task video field is required."
],
"task_img": [
"The task img field is required."
],
"worker_audit_meta": [
"The worker audit meta field is required."
],
"worker_audit_meta.0.staff_id": [
"The worker audit meta.0.staff id field is required."
],
"worker_audit_meta.0.meta": [
"The worker audit meta.0.meta field must be an array."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Task Management
Display a listing of tasks with their assigned workers and individual meta data.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tasks?location_id=1&task_type=manuring&task_status=in_progress&task_name=Fertilize" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks"
);
const params = {
"location_id": "1",
"task_type": "manuring",
"task_status": "in_progress",
"task_name": "Fertilize",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'location_id' => '1',
'task_type' => 'manuring',
'task_status' => 'in_progress',
'task_name' => 'Fertilize',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks'
params = {
'location_id': '1',
'task_type': 'manuring',
'task_status': 'in_progress',
'task_name': 'Fertilize',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": [
{
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilize Field A",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": null,
"meta": {},
"workers": [
{
"id": 1,
"fullName": "John Doe",
"phone": "019-1234567",
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": "50"
}
},
{
"id": 2,
"fullName": "Jane Smith",
"phone": "019-7654321",
"meta": {
"fertilizer_type": "Urea",
"fertilizer_amount": "30"
}
}
],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
],
"pagination": {
"current_page": 1,
"last_page": 1,
"per_page": 15,
"total": 1
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created group task in storage (Step 1 of 2).
requires authentication
This creates a group task without workers. Use POST /tasks/{task}/assign-workers to assign workers with their individual meta data (Step 2).
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tasks" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"location_id\": 1,
\"task_name\": \"\\\"Fertilize Field A\\\"\",
\"task_type\": \"manuring\",
\"task_date\": \"2025-01-15\",
\"task_status\": \"completed\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"location_id": 1,
"task_name": "\"Fertilize Field A\"",
"task_type": "manuring",
"task_date": "2025-01-15",
"task_status": "completed"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'location_id' => 1,
'task_name' => '"Fertilize Field A"',
'task_type' => 'manuring',
'task_date' => '2025-01-15',
'task_status' => 'completed',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks'
payload = {
"location_id": 1,
"task_name": "\"Fertilize Field A\"",
"task_type": "manuring",
"task_date": "2025-01-15",
"task_status": "completed"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success - Group Task Created):
{
"success": true,
"message": "Task created successfully.",
"data": {
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilize Field A",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": null,
"meta": {},
"workers": [],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation Error):
{
"success": false,
"message": "One or more selected workers are not claimed by the current manager."
}
Example response (500, Server Error):
{
"success": false,
"message": "Failed to create task.",
"error": "Error message"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get task breakdown for a single worker for a specific month.
requires authentication
Returns all tasks assigned to the specified worker for the month. Endpoint: GET /tasks/staff/{staff}/breakdown-by-worker?month=1&year=2025
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tasks/staff/16/breakdown-by-worker?month=1&year=2025" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/staff/16/breakdown-by-worker"
);
const params = {
"month": "1",
"year": "2025",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/staff/16/breakdown-by-worker';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '1',
'year' => '2025',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/staff/16/breakdown-by-worker'
params = {
'month': '1',
'year': '2025',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": [
{
"worker_id": 1,
"worker_name": "John Doe",
"worker_phone": "019-1234567",
"tasks": [
{
"id": 1,
"task_name": "Fertilize Field A",
"task_type": "manuring",
"task_date": "2025-01-15",
"task_status": "completed",
"location": {
"id": 1,
"name": "A01"
},
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": "50"
}
},
{
"id": 2,
"task_name": "Prune Trees",
"task_type": "pruning",
"task_date": "2025-01-20",
"task_status": "completed",
"location": {
"id": 2,
"name": "B02"
},
"meta": {
"pruning_type": "normal pruning"
}
}
],
"total_tasks": 2
},
{
"worker_id": 2,
"worker_name": "Jane Smith",
"worker_phone": "019-7654321",
"tasks": [
{
"id": 3,
"task_name": "Harvest Fruits",
"task_type": "harvesting",
"task_date": "2025-01-18",
"task_status": "completed",
"location": {
"id": 3,
"name": "C03"
},
"meta": {
"harvesting_type": "normal harvesting"
}
}
],
"total_tasks": 1
}
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The month field is required.",
"errors": {
"month": [
"The month field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get task breakdown for all workers in a specific location.
requires authentication
Returns all workers that have tasks in the specified location, with their tasks, types, statuses, and metadata, grouped by worker. Endpoint: GET /tasks/location/{location}/breakdown-by-location
Optional filters:
- month & year: to limit tasks within a given month
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tasks/location/16/breakdown-by-location?month=1&year=2025&task_type=manuring" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/location/16/breakdown-by-location"
);
const params = {
"month": "1",
"year": "2025",
"task_type": "manuring",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/location/16/breakdown-by-location';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '1',
'year' => '2025',
'task_type' => 'manuring',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/location/16/breakdown-by-location'
params = {
'month': '1',
'year': '2025',
'task_type': 'manuring',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"location": {
"id": 1,
"name": "A01",
"isActive": true,
"createdAt": "2025-11-06 12:13:38",
"updatedAt": "2025-11-06 12:13:38"
},
"workers": [
{
"worker_id": 1,
"worker_name": "John Doe",
"worker_phone": "019-1234567",
"tasks": [
{
"id": 1,
"task_name": "Fertilize Field A",
"task_type": "manuring",
"task_date": "2025-01-15",
"task_status": "completed",
"location": {
"id": 1,
"name": "A01"
},
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": "50"
}
}
],
"total_tasks": 1
}
]
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specified task with workers and their individual meta data.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tasks/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"data": {
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilize Field A",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": null,
"meta": {},
"workers": [
{
"id": 1,
"fullName": "John Doe",
"phone": "019-1234567",
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": "50"
}
},
{
"id": 2,
"fullName": "Jane Smith",
"phone": "019-7654321",
"meta": {
"fertilizer_type": "Urea",
"fertilizer_amount": "30"
}
}
],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified task in storage (basic info only).
requires authentication
Note: To assign/reassign workers, use the POST /tasks/{task}/assign-workers endpoint.
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/tasks/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"task_name\": \"\\\"Updated Task Name\\\"\",
\"task_type\": \"sanitation\",
\"task_date\": \"2025-01-20\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"task_name": "\"Updated Task Name\"",
"task_type": "sanitation",
"task_date": "2025-01-20"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'task_name' => '"Updated Task Name"',
'task_type' => 'sanitation',
'task_date' => '2025-01-20',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16'
payload = {
"task_name": "\"Updated Task Name\"",
"task_type": "sanitation",
"task_date": "2025-01-20"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Task updated successfully.",
"data": {
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Updated Task Name",
"taskType": "sanitation",
"taskDate": "2025-01-20",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": null,
"meta": {},
"workers": [],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Example response (500, Server Error):
{
"success": false,
"message": "Failed to update task.",
"error": "Error message"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Submit a task for review.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tasks/16/submit" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16/submit"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/submit';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/submit'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Task submitted successfully.",
"data": {
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilize Field A",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "pending",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": "2025-01-15 14:30:00",
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": "100"
},
"workers": [],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-15 14:30:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Example response (422, Task not in progress):
{
"success": false,
"message": "Task must be in progress to be submitted."
}
Example response (500, Server Error):
{
"success": false,
"message": "Failed to submit task.",
"error": "Error message"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Resume a rejected task back to in_progress status.
requires authentication
This endpoint allows managers to resume work on a task that was previously rejected by a checker. The task status will be changed from "rejected" to "in_progress".
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tasks/16/resume" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"remarks\": \"\\\"Addressing feedback from checker\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16/resume"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"remarks": "\"Addressing feedback from checker\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/resume';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'remarks' => '"Addressing feedback from checker"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/resume'
payload = {
"remarks": "\"Addressing feedback from checker\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Task resumed successfully.",
"data": {
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilize Field A",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": null,
"meta": {},
"workers": [],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-15 14:30:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Example response (422, Task not rejected):
{
"success": false,
"message": "Task must be in rejected status to be resumed."
}
Example response (500, Server Error):
{
"success": false,
"message": "Failed to resume task.",
"error": "Error message"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Assign workers to an existing task with their individual meta data (Step 2 of 2).
requires authentication
This endpoint assigns workers to a group task and stores each worker's individual meta data. Use this after creating a task with POST /tasks.
Behavior:
- If a worker (staff_id) is already assigned to the task, their metadata will be updated
- If a worker is new, they will be added to the task
- Existing workers not included in the request will remain assigned
- To add one more worker, simply send only the new worker's data
- To update a worker's metadata, send their staff_id with new meta values
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tasks/16/assign-workers" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"workers\": {
\"0\": {
\"staff_id\": 1,
\"meta\": {
\"fertilizer_type\": \"NPK\",
\"fertilizer_amount\": 50
}
},
\"1\": {
\"staff_id\": 2,
\"meta\": {
\"fertilizer_type\": \"MOP\",
\"fertilizer_amount\": 30
}
},
\"*\": {
\"meta\": {
\"pruning_type\": \"\\\"normal pruning\\\"\",
\"harvesting_type\": \"\\\"normal harvesting\\\"\",
\"fertilizer_type\": \"\\\"NPK\\\"\",
\"fertilizer_amount\": 50,
\"sanitation_type\": \"\\\"spraying\\\"\",
\"herbicide_amount\": 100
}
}
}
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16/assign-workers"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"workers": {
"0": {
"staff_id": 1,
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": 50
}
},
"1": {
"staff_id": 2,
"meta": {
"fertilizer_type": "MOP",
"fertilizer_amount": 30
}
},
"*": {
"meta": {
"pruning_type": "\"normal pruning\"",
"harvesting_type": "\"normal harvesting\"",
"fertilizer_type": "\"NPK\"",
"fertilizer_amount": 50,
"sanitation_type": "\"spraying\"",
"herbicide_amount": 100
}
}
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/assign-workers';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => \Symfony\Component\VarExporter\Internal\Hydrator::hydrate(
$o = [
clone (($p = &\Symfony\Component\VarExporter\Internal\Registry::$prototypes)['stdClass'] ?? \Symfony\Component\VarExporter\Internal\Registry::p('stdClass')),
clone $p['stdClass'],
clone $p['stdClass'],
clone $p['stdClass'],
],
null,
[
'stdClass' => [
'staff_id' => [
1,
2 => 2,
],
'meta' => [
$o[1],
2 => $o[3],
],
'fertilizer_type' => [
1 => 'NPK',
3 => 'MOP',
],
'fertilizer_amount' => [
1 => 50,
3 => 30,
],
],
],
[
'workers' => [
$o[0],
$o[2],
'*' => [
'meta' => [
'pruning_type' => '"normal pruning"',
'harvesting_type' => '"normal harvesting"',
'fertilizer_type' => '"NPK"',
'fertilizer_amount' => 50,
'sanitation_type' => '"spraying"',
'herbicide_amount' => 100,
],
],
],
],
[]
),
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/assign-workers'
payload = {
"workers": {
"0": {
"staff_id": 1,
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": 50
}
},
"1": {
"staff_id": 2,
"meta": {
"fertilizer_type": "MOP",
"fertilizer_amount": 30
}
},
"*": {
"meta": {
"pruning_type": "\"normal pruning\"",
"harvesting_type": "\"normal harvesting\"",
"fertilizer_type": "\"NPK\"",
"fertilizer_amount": 50,
"sanitation_type": "\"spraying\"",
"herbicide_amount": 100
}
}
}
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Workers assigned successfully.",
"data": {
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilize Field A",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": null,
"meta": {},
"workers": [
{
"id": 1,
"fullName": "John Doe",
"phone": "019-1234567",
"meta": {
"fertilizer_type": "NPK",
"fertilizer_amount": "50"
}
}
],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "One or more selected workers are not claimed by the current manager."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove workers from a task.
requires authentication
This endpoint removes one or more workers from a task along with their metadata.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/tasks/16/remove-workers" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"staff_ids\": [
1,
2,
3
]
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16/remove-workers"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"staff_ids": [
1,
2,
3
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/remove-workers';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'staff_ids' => [
1,
2,
3,
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/remove-workers'
payload = {
"staff_ids": [
1,
2,
3
]
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Workers removed successfully.",
"data": {
"id": 1,
"location": {
"id": 1,
"name": "A01"
},
"taskName": "Fertilize Field A",
"taskType": "manuring",
"taskDate": "2025-01-15",
"taskStatus": "in_progress",
"createdBy": {
"id": 1,
"name": "Manager Name"
},
"submittedAt": null,
"meta": {},
"workers": [],
"createdAt": "2025-01-01 00:00:00",
"updatedAt": "2025-01-01 00:00:00"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The staff ids field is required."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get task logs for a specific task.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/tasks/16/logs" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16/logs"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/logs';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16/logs'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"data": [
{
"id": 1,
"task_id": 1,
"user_id": 2,
"task_status": "approved",
"remarks": "Task completed successfully",
"user": {
"id": 2,
"user_fullname": "Manager Name"
},
"created_at": "2025-01-15 14:30:00",
"updated_at": "2025-01-15 14:30:00"
},
{
"id": 2,
"task_id": 1,
"user_id": 2,
"task_status": "rejected",
"remarks": "Need more details",
"user": {
"id": 2,
"user_fullname": "Manager Name"
},
"created_at": "2025-01-15 10:15:00",
"updated_at": "2025-01-15 10:15:00"
}
]
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the specified task from storage.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/tasks/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/tasks/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/tasks/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/tasks/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Task deleted successfully."
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Task not found):
{
"success": false,
"message": "Task not found"
}
Example response (500, Server Error):
{
"success": false,
"message": "Failed to delete task.",
"error": "Error message"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
User Attendance
Get User Attendance Records
requires authentication
Retrieve a paginated list of user attendance records for a specific date attendance. This endpoint returns all user members with their attendance status (Absent, Check in, or Present) for the specified date attendance ID.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/user-attendance?date_attendance_id=1&page=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 16,
\"page\": 22,
\"per_page\": 7
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance"
);
const params = {
"date_attendance_id": "1",
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 16,
"page": 22,
"per_page": 7
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'date_attendance_id' => '1',
'page' => '1',
'per_page' => '10',
],
'json' => [
'date_attendance_id' => 16,
'page' => 22,
'per_page' => 7,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance'
payload = {
"date_attendance_id": 16,
"page": 22,
"per_page": 7
}
params = {
'date_attendance_id': '1',
'page': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "User attendance retrieved successfully",
"data": {
"data": [
{
"user_id": 1,
"user_img": "user_avatar.jpg",
"user_name": "John Doe",
"status": "Present",
"check_in": "2025-01-15 08:00:00",
"check_out": "2025-01-15 17:00:00",
"checkedin_by": "Admin User",
"checkedout_by": "Admin User"
},
{
"user_id": 2,
"user_img": "user_avatar2.jpg",
"user_name": "Jane Smith",
"status": "Check_in",
"check_in": "2025-01-15 08:30:00",
"check_out": null,
"checkedin_by": "Manager User",
"checkedout_by": null
},
{
"user_id": 3,
"user_img": "user_avatar3.jpg",
"user_name": "Mike Johnson",
"status": "Absent",
"check_in": null,
"check_out": null,
"checkedin_by": null,
"checkedout_by": null
}
],
"current_page": 1,
"per_page": 15,
"total": 50,
"last_page": 4,
"from": 1,
"to": 15
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"date_attendance_id": [
"The date attendance id field is required."
],
"page": [
"The page field must be at least 1."
],
"per_page": [
"The per page field must not be greater than 100."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Show User Attendance Analytics
requires authentication
Retrieve the analytics of a user attendance record. This endpoint returns the analytics of the attendance record for the user ID.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/analytics?month=2025-01" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/analytics"
);
const params = {
"month": "2025-01",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/analytics';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '2025-01',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/analytics'
params = {
'month': '2025-01',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "User attendance analytics retrieved successfully",
"data": {
"user_id": 1,
"month": "2025-01",
"attendance_rate": 90,
"punctuality_rate": 90,
"number_absent": 1,
"total_days": 20,
"total_present": 18
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to view user attendance"
}
Example response (404, Not Found):
{
"success": false,
"message": "User not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Specific User Attendance Records
requires authentication
Retrieve the details of a specific user attendance record. This endpoint returns the attendance record for the specified user ID and month.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/records?month=2025-01&status=present%2C+check_in%2C+check_out%2C+absent&page=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/records"
);
const params = {
"month": "2025-01",
"status": "present, check_in, check_out, absent",
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/records';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '2025-01',
'status' => 'present, check_in, check_out, absent',
'page' => '1',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/records'
params = {
'month': '2025-01',
'status': 'present, check_in, check_out, absent',
'page': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "User attendance retrieved successfully",
"data": {
"data": [
{
"id": 1,
"date": "19-01-2025",
"status": "Present",
"checkedin_by": "Admin User",
"checkedout_by": "Admin User",
"check_in": "2025-01-19 07:30:00",
"check_out": "2025-01-19 17:00:00",
"duration": 34200,
"remark_late": null,
"notes": null
},
{
"id": 2,
"date": "20-01-2025",
"status": "Check_in",
"checkedin_by": "Manager User",
"checkedout_by": null,
"check_in": "2025-01-20 08:00:00",
"check_out": null,
"duration": null,
"remark_late": "Traffic jam",
"notes": null
},
{
"id": 3,
"date": "21-01-2025",
"status": "Absent",
"checkedin_by": null,
"checkedout_by": null,
"check_in": null,
"check_out": null,
"duration": null,
"remark_late": null,
"notes": null
}
],
"current_page": 1,
"per_page": 15,
"total": 50,
"last_page": 4,
"from": 1,
"to": 15
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Not Found):
{
"success": false,
"message": "User not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"user_id": [
"The user id field is required."
],
"month": [
"The month field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get User Leave Records
requires authentication
Retrieve a paginated list of user leave attendance records. This endpoint returns only leave types (sick_leave, annual_leave, unpaid_leave).
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/leaves?month=2025-01&status=%22sick_leave%22&page=1&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/leaves"
);
const params = {
"month": "2025-01",
"status": ""sick_leave"",
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/leaves';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'month' => '2025-01',
'status' => '"sick_leave"',
'page' => '1',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/architecto/leaves'
params = {
'month': '2025-01',
'status': '"sick_leave"',
'page': '1',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "User leave records retrieved successfully",
"data": {
"data": [
{
"id": 1,
"date": "24-10-2025",
"type_of_leave": "Annual Leave",
"created_by": "Admin User",
"created_at": "2025-10-24T08:00:00.000000Z",
"start_date": "24-10-2025",
"end_date": "24-10-2025",
"remarks": "Going back to hometown: Family passed away"
},
{
"id": 2,
"date": "25-10-2025",
"type_of_leave": "Sick Leave",
"created_by": "Manager User",
"created_at": "2025-10-25T08:00:00.000000Z",
"start_date": "25-10-2025",
"end_date": "25-10-2025",
"remarks": "Medical appointment"
}
],
"current_page": 1,
"per_page": 15,
"total": 50,
"last_page": 4,
"from": 1,
"to": 15
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, Not Found):
{
"success": false,
"message": "User not found"
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"month": [
"The month must be in Y-m format (e.g., 2025-01)"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check In User
requires authentication
Record user check-in time with offline sync support. This endpoint handles duplicate submissions intelligently by always saving the earliest time.
Offline Sync Logic:
- Always saves the earliest check-in time submitted
- Updates remarks when check-in time is updated
- Preserves existing check-out data and recalculates duration
- Maintains checker information for audit trail
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/user-attendance/check-in" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 1,
\"user_id\": 1,
\"check_in\": \"2025-01-15 08:00:00\",
\"remark_late\": \"\\\"Traffic jam\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/check-in"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 1,
"user_id": 1,
"check_in": "2025-01-15 08:00:00",
"remark_late": "\"Traffic jam\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/check-in';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date_attendance_id' => 1,
'user_id' => 1,
'check_in' => '2025-01-15 08:00:00',
'remark_late' => '"Traffic jam"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/check-in'
payload = {
"date_attendance_id": 1,
"user_id": 1,
"check_in": "2025-01-15 08:00:00",
"remark_late": "\"Traffic jam\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, New Check-in Record):
{
"success": true,
"message": "You checked in successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 08:00:00",
"check_out": null,
"status": "check_in",
"duration": null,
"remark_late": "Traffic jam",
"notes": null,
"checkedin_by": 1,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, Updated Check-in Time):
{
"success": true,
"message": "User check-in updated successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 07:30:00",
"check_out": "2025-01-15 17:00:00",
"status": "present",
"duration": 34200,
"remark_late": "Early arrival",
"notes": null,
"checkedin_by": 2,
"checkedout_by": 1,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T07:30:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record attendance"
}
Example response (422, Validation Error):
{
"success": false,
"message": "Validation Error",
"errors": {
"check_in": [
"The check in field is required."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check Out User
requires authentication
Record user check-out time with offline sync support. This endpoint handles duplicate submissions intelligently by always saving the latest time.
Offline Sync Logic:
- Always saves the latest check-out time submitted
- Requires existing check-in before allowing check-out
- Automatically calculates duration when both times exist
- Maintains checker information for audit trail
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/user-attendance/check-out" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 1,
\"user_id\": 1,
\"check_out\": \"2025-01-15 17:00:00\",
\"notes\": \"architecto\",
\"remark_ot\": \"\\\"Extra work required\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/check-out"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 1,
"user_id": 1,
"check_out": "2025-01-15 17:00:00",
"notes": "architecto",
"remark_ot": "\"Extra work required\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/check-out';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date_attendance_id' => 1,
'user_id' => 1,
'check_out' => '2025-01-15 17:00:00',
'notes' => 'architecto',
'remark_ot' => '"Extra work required"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/check-out'
payload = {
"date_attendance_id": 1,
"user_id": 1,
"check_out": "2025-01-15 17:00:00",
"notes": "architecto",
"remark_ot": "\"Extra work required\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, New Check-out Record):
{
"success": true,
"message": "You checked out successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 08:00:00",
"check_out": "2025-01-15 17:00:00",
"status": "present",
"duration": 32400,
"remark_late": null,
"notes": "Extra work required",
"checkedin_by": 1,
"checkedout_by": 1,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T17:00:00.000000Z"
}
}
Example response (201, Updated Check-out Time):
{
"success": true,
"message": "User check-out updated successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15 08:00:00",
"check_out": "2025-01-15 18:00:00",
"status": "present",
"duration": 36000,
"remark_late": null,
"notes": "Extended hours",
"checkedin_by": 1,
"checkedout_by": 2,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T18:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record attendance"
}
Example response (422, No Check-in Found):
{
"success": false,
"message": "Validation Error",
"errors": {
"check_out": [
"User must check in before checking out"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Mark User as Absent
requires authentication
Mark user as absent for a specific date attendance. This will clear any existing check-in/out times and set status to absent. If user has already checked in, the request will be ignored.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/user-attendance/mark-absent" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"date_attendance_id\": 1,
\"user_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/mark-absent"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"date_attendance_id": 1,
"user_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/mark-absent';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'date_attendance_id' => 1,
'user_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/mark-absent'
payload = {
"date_attendance_id": 1,
"user_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, User Already Present):
{
"success": true,
"message": "User is already present, absent request ignored",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15T08:00:00.000000Z",
"check_out": null,
"status": "check_in",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": 1,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, User Marked Absent):
{
"success": true,
"message": "You marked yourself as absent successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "absent",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": null,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record attendance"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Mark User as Leave
requires authentication
Mark user as leave (sick leave, annual leave, or unpaid leave) for a date range. This will clear any existing check-in/out times and set status to the specified leave type for each date. If user has already checked in on a date, that date will be skipped.
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/user-attendance/mark-leave" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"user_id\": 1,
\"from_date\": \"2025-01-01\",
\"to_date\": \"2025-01-03\",
\"status\": \"\\\"sick_leave\\\"\",
\"notes\": \"\\\"Sick leave for 1 day\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/mark-leave"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"user_id": 1,
"from_date": "2025-01-01",
"to_date": "2025-01-03",
"status": "\"sick_leave\"",
"notes": "\"Sick leave for 1 day\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/mark-leave';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'user_id' => 1,
'from_date' => '2025-01-01',
'to_date' => '2025-01-03',
'status' => '"sick_leave"',
'notes' => '"Sick leave for 1 day"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/mark-leave'
payload = {
"user_id": 1,
"from_date": "2025-01-01",
"to_date": "2025-01-03",
"status": "\"sick_leave\"",
"notes": "\"Sick leave for 1 day\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, User Already Present):
{
"success": true,
"message": "You are already present, leave request ignored",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": "2025-01-15T08:00:00.000000Z",
"check_out": null,
"status": "check_in",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": 1,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, User Marked Sick Leave):
{
"success": true,
"message": "You marked yourself as sick leave successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "sick_leave",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": null,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (201, User Marked Annual Leave):
{
"success": true,
"message": "User marked as annual leave successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "annual_leave",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": null,
"checkedout_by": null,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T08:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record attendance"
}
Example response (422, Validation Error):
{
"success": false,
"message": "Validation Error",
"errors": {
"status": [
"The selected status is invalid."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update User Leave Attendance
requires authentication
Update a user leave attendance record. Only leave types (sick_leave, annual_leave, unpaid_leave) can be updated.
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/user-attendance/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"status\": \"\\\"sick_leave\\\"\",
\"notes\": \"\\\"Updated sick leave notes\\\"\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "\"sick_leave\"",
"notes": "\"Updated sick leave notes\""
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/1';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'status' => '"sick_leave"',
'notes' => '"Updated sick leave notes"',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/1'
payload = {
"status": "\"sick_leave\"",
"notes": "\"Updated sick leave notes\""
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "User leave attendance updated successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "sick_leave",
"duration": null,
"remark_late": null,
"notes": "Updated sick leave notes",
"checkedin_by": 2,
"checkedout_by": 2,
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T09:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record attendance"
}
Example response (404, Not Found):
{
"success": false,
"message": "Attendance record not found"
}
Example response (422, Not a Leave Type):
{
"success": false,
"message": "Only leave attendance records can be updated"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete User Leave Attendance
requires authentication
Soft delete a user leave attendance record. Only leave types (sick_leave, annual_leave, unpaid_leave) can be deleted.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/user-attendance/1" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/1"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/1';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/1'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "User leave attendance deleted successfully",
"data": {
"id": 1,
"user_id": 1,
"date_attendance_id": 1,
"check_in": null,
"check_out": null,
"status": "sick_leave",
"duration": null,
"remark_late": null,
"notes": null,
"checkedin_by": 2,
"checkedout_by": 2,
"deleted_at": "2025-01-15T09:00:00.000000Z",
"created_at": "2025-01-15T08:00:00.000000Z",
"updated_at": "2025-01-15T09:00:00.000000Z"
}
}
Example response (403, Forbidden):
{
"success": false,
"message": "You do not have permission to record attendance"
}
Example response (404, Not Found):
{
"success": false,
"message": "Attendance record not found"
}
Example response (422, Not a Leave Type):
{
"success": false,
"message": "Only leave attendance records can be deleted"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Mark All attendance that is not checked out yet to be checked out
requires authentication
Mark user attendance that is not checked out yet to set the checkout time. Checkout time will be set to 4pm on the same date as check-in. Should be done with cron job every 7 PM. Only for user attendance that is not checked out yet. Processes all attendance records (not just today).
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/user-attendance/auto-checkout" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/user-attendance/auto-checkout"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/auto-checkout';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/user-attendance/auto-checkout'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()Example response (200, All attendance that is not checked out yet to be checked out):
{
"success": true,
"message": "All attendance that is not checked out yet to be checked out",
"data": {
"count": 10
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
User Payroll Management
Get list of users with their payroll information for manage payroll page.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payroll/users?role=mandor&search=john" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/users"
);
const params = {
"role": "mandor",
"search": "john",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/users';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'role' => 'mandor',
'search' => 'john',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/users'
params = {
'role': 'mandor',
'search': 'john',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Users list retrieved successfully",
"data": [
{
"id": 1,
"user_fullname": "Oikawa Yamaguchi",
"user_nickname": "Oikawa",
"user_role": "mandor",
"user_img": null,
"user_dob": "1996-01-15",
"age": 29,
"user_employment_start_date": "2024-02-01",
"joined_since": "2024",
"base_salary": {
"base_salary": 2500,
"updated_at": "2025-11-04T10:00:00.000000Z"
},
"payslips_count": 5
}
]
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get employment overview for a specific user including all payslip records.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payroll/users/16/overview" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/users/16/overview"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/users/16/overview';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/users/16/overview'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Employment overview retrieved successfully",
"data": {
"user": {
"id": 1,
"user_fullname": "Oikawa Yamaguchi",
"user_nickname": "Oikawa",
"user_role": "mandor",
"user_img": null,
"user_dob": "1996-01-15",
"age": 29,
"user_employment_start_date": "2024-02-01",
"joined_since": "2024"
},
"base_salary": 2500,
"payslips": [
{
"id": 5,
"payslip_month": "May 2025",
"payslip_month_short": "05/25",
"net_salary": 1571.3800000000001091393642127513885498046875,
"status": "generated",
"created_at": "2025-11-05T08:30:00.000000Z"
}
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Generate a new payslip for a user.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/payroll/users/16/generate" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"payslip_month\": \"06\\/25\",
\"base_salary\": 2500,
\"deductions\": [
\"architecto\"
],
\"advance_repayment_amount\": 5,
\"advance_repayment_remarks\": \"j\",
\"employer_epf\": 17,
\"employer_socso\": 5,
\"employer_eis\": 8,
\"employer_pcb\": 14
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/users/16/generate"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"payslip_month": "06\/25",
"base_salary": 2500,
"deductions": [
"architecto"
],
"advance_repayment_amount": 5,
"advance_repayment_remarks": "j",
"employer_epf": 17,
"employer_socso": 5,
"employer_eis": 8,
"employer_pcb": 14
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/users/16/generate';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'payslip_month' => '06/25',
'base_salary' => 2500.0,
'deductions' => [
'architecto',
],
'advance_repayment_amount' => 5,
'advance_repayment_remarks' => 'j',
'employer_epf' => 17,
'employer_socso' => 5,
'employer_eis' => 8,
'employer_pcb' => 14,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/users/16/generate'
payload = {
"payslip_month": "06\/25",
"base_salary": 2500,
"deductions": [
"architecto"
],
"advance_repayment_amount": 5,
"advance_repayment_remarks": "j",
"employer_epf": 17,
"employer_socso": 5,
"employer_eis": 8,
"employer_pcb": 14
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Payslip generated successfully",
"data": {
"id": 1,
"user_id": 1,
"payslip_month": "06/25",
"base_salary": 2500,
"total_deduction": 228.6200000000000045474735088646411895751953125,
"total_income": 2500,
"net_salary": 2271.3800000000001091393642127513885498046875,
"status": "generated",
"deductions": [
{
"id": 1,
"deduction_type": "EPF",
"deduction_amount": 130.1200000000000045474735088646411895751953125,
"deduction_note": "Monthly EPF"
},
{
"id": 2,
"deduction_type": "Lateness",
"deduction_amount": 98.5,
"deduction_note": "3 times late"
}
]
}
}
Example response (422, Validation error):
{
"success": false,
"message": "Payslip for this month already exists"
}
Example response (422, No base salary):
{
"success": false,
"message": "User does not have a base salary set. Please set base salary first."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get detailed payslip information.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/payroll/payslips/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/payslips/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/payslips/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/payslips/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Payslip details retrieved successfully",
"data": {
"id": 1,
"user": {
"id": 1,
"user_fullname": "Oikawa Yamaguchi",
"user_ic": "6718081017182",
"user_bank_name": "Maybank",
"user_bank_number": "161178229300",
"user_kwsp_number": "123456789012"
},
"payslip_month": "06/25",
"payslip_month_readable": "June 2025",
"base_salary": 1800,
"total_income": 1800,
"total_deduction": 228.6200000000000045474735088646411895751953125,
"net_salary": 1571.3800000000001091393642127513885498046875,
"status": "generated",
"deductions": [
{
"id": 1,
"deduction_type": "EPF",
"deduction_amount": 130.1200000000000045474735088646411895751953125,
"deduction_note": null
},
{
"id": 2,
"deduction_type": "Early Out",
"deduction_amount": 67.75,
"deduction_note": "2 days early checkout"
},
{
"id": 3,
"deduction_type": "Lateness",
"deduction_amount": 30.75,
"deduction_note": "Late arrival 3 times"
}
],
"approved_by": null,
"received_by": null,
"created_at": "2025-11-05T08:30:00.000000Z"
}
}
Example response (404, Not found):
{
"success": false,
"message": "Payslip not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a payslip.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/payroll/payslips/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/payroll/payslips/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/payroll/payslips/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/payroll/payslips/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Payslip deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Users
List Users
requires authentication
Returns a paginated list of users. Optionally filter by role.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/users?role=manager&search=john&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"role\": \"mandor\",
\"search\": \"architecto\",
\"per_page\": 22
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users"
);
const params = {
"role": "manager",
"search": "john",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"role": "mandor",
"search": "architecto",
"per_page": 22
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'role' => 'manager',
'search' => 'john',
'per_page' => '10',
],
'json' => [
'role' => 'mandor',
'search' => 'architecto',
'per_page' => 22,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users'
payload = {
"role": "mandor",
"search": "architecto",
"per_page": 22
}
params = {
'role': 'manager',
'search': 'john',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Users retrieved successfully",
"data": [
{
"id": 2,
"user_fullname": "Manager Name",
"user_nickname": "manager1",
"user_role": "manager",
"user_img": null,
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_employment_start_date": "2024-01-15",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890"
},
{
"id": 3,
"user_fullname": "Mandor Name",
"user_nickname": "mandor1",
"user_role": "mandor",
"user_img": null,
"staff_count": 5,
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_employment_start_date": "2024-01-15",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 2,
"last_page": 1
}
}
Example response (422, Validation Error):
{
"success": false,
"message": "The given data was invalid.",
"errors": {
"role": [
"The selected role is invalid."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Show User Details
requires authentication
Retrieve detailed information about a specific user.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/users/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "User details retrieved successfully",
"data": {
"id": 2,
"user_fullname": "Manager Name",
"user_nickname": "manager1",
"user_role": "manager",
"user_img": null,
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_employment_start_date": "2024-01-15",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"staff_count": 5,
"attendance_count_month": 15,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (404, User not found):
{
"success": false,
"message": "User not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Admin Update User
requires authentication
Allow an admin to update another user's details (profile, role, personal info, etc).
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/users/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"user_fullname\": \"John Doe\",
\"user_nickname\": \"johndoe\",
\"user_phone\": \"+1234567890\",
\"user_role\": \"manager\",
\"user_gender\": \"male\",
\"user_dob\": \"1990-01-01\",
\"user_ic\": \"123456789012\",
\"user_bank_name\": \"Maybank\",
\"user_bank_number\": \"1234567890\",
\"user_kwsp_number\": \"1234567890\",
\"user_employment_start_date\": \"2024-01-15\",
\"user_img\": \"https:\\/\\/example.com\\/image.jpg\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"user_fullname": "John Doe",
"user_nickname": "johndoe",
"user_phone": "+1234567890",
"user_role": "manager",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_ic": "123456789012",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15",
"user_img": "https:\/\/example.com\/image.jpg"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users/16';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'user_fullname' => 'John Doe',
'user_nickname' => 'johndoe',
'user_phone' => '+1234567890',
'user_role' => 'manager',
'user_gender' => 'male',
'user_dob' => '1990-01-01',
'user_ic' => '123456789012',
'user_bank_name' => 'Maybank',
'user_bank_number' => '1234567890',
'user_kwsp_number' => '1234567890',
'user_employment_start_date' => '2024-01-15',
'user_img' => 'https://example.com/image.jpg',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users/16'
payload = {
"user_fullname": "John Doe",
"user_nickname": "johndoe",
"user_phone": "+1234567890",
"user_role": "manager",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_ic": "123456789012",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15",
"user_img": "https:\/\/example.com\/image.jpg"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "User updated successfully",
"data": {
"id": 5,
"user_nickname": "johndoe",
"user_fullname": "John Doe",
"user_role": "manager",
"user_img": "https://example.com/image.jpg",
"user_phone": "+1234567890",
"user_ic": "123456789012",
"user_gender": "male",
"user_dob": "1990-01-01",
"user_bank_name": "Maybank",
"user_bank_number": "1234567890",
"user_kwsp_number": "1234567890",
"user_employment_start_date": "2024-01-15"
}
}
Example response (403, Forbidden - Not Admin):
{
"success": false,
"message": "Only admins can update other users"
}
Example response (404, User not found):
{
"success": false,
"message": "User not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Admin Change Password
requires authentication
Allow an admin to reset the password for another user (manager, mandor, checker, etc).
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/users/16/change-password" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"password\": \"|]|{+-\",
\"password_confirmation\": \"architecto\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users/16/change-password"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"password": "|]|{+-",
"password_confirmation": "architecto"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users/16/change-password';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'password' => '|]|{+-',
'password_confirmation' => 'architecto',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users/16/change-password'
payload = {
"password": "|]|{+-",
"password_confirmation": "architecto"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Password reset successfully"
}
Example response (403, Forbidden - Not Admin):
{
"success": false,
"message": "Only admins can reset user passwords"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete a user.
requires authentication
Permanently delete a user from the system. Only admins can delete users. Users cannot delete themselves. This will also delete related records such as claimed staff assignments, base salary, and API tokens.
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/users/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "User deleted successfully"
}
Example response (400, Cannot delete self):
{
"success": false,
"message": "You cannot delete your own account"
}
Example response (401, Unauthenticated):
{
"success": false,
"message": "Unauthorized"
}
Example response (403, Forbidden - Not Admin):
{
"success": false,
"message": "Only admins can delete users"
}
Example response (404, User not found):
{
"success": false,
"message": "User not found"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Users and Staff
requires authentication
Returns a list of users and staff.
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/users-and-staff?search=john" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"search\": \"architecto\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/users-and-staff"
);
const params = {
"search": "john",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "architecto"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/users-and-staff';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'john',
],
'json' => [
'search' => 'architecto',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/users-and-staff'
payload = {
"search": "architecto"
}
params = {
'search': 'john',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Users and Staff retrieved successfully",
"data": [
{
"user_id": 1,
"fullname": "Manager Name",
"role": "user",
"img": null,
},
{
"staff_id": 3,
"fullname": "Staff Name",
"role": "staff",
"img": null,
}
],
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Vehicle Booking Management
Get all vehicle bookings.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/vehicle-bookings?search=Toyota&vehicle_id=1&user_id=1&staff_id=1&date_from=2025-01-01&date_to=2025-12-31&bookingFilter=booking-asc&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings"
);
const params = {
"search": "Toyota",
"vehicle_id": "1",
"user_id": "1",
"staff_id": "1",
"date_from": "2025-01-01",
"date_to": "2025-12-31",
"bookingFilter": "booking-asc",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'Toyota',
'vehicle_id' => '1',
'user_id' => '1',
'staff_id' => '1',
'date_from' => '2025-01-01',
'date_to' => '2025-12-31',
'bookingFilter' => 'booking-asc',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings'
params = {
'search': 'Toyota',
'vehicle_id': '1',
'user_id': '1',
'staff_id': '1',
'date_from': '2025-01-01',
'date_to': '2025-12-31',
'bookingFilter': 'booking-asc',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicle bookings retrieved successfully",
"data": [
{
"id": 1,
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": "2025-01-01 18:00:00",
"user_id": 1,
"staff_id": null,
"vehicle": {
"id": 1,
"vehicle_name": "Toyota Hilux"
},
"user": {
"id": 1,
"user_fullname": "John Doe"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created vehicle booking.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"vehicle_id\": 1,
\"datetime_booking\": \"2025-01-01 10:00:00\",
\"datetime_return\": \"2025-01-01 18:00:00\",
\"user_id\": 1,
\"staff_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": "2025-01-01 18:00:00",
"user_id": 1,
"staff_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'vehicle_id' => 1,
'datetime_booking' => '2025-01-01 10:00:00',
'datetime_return' => '2025-01-01 18:00:00',
'user_id' => 1,
'staff_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings'
payload = {
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": "2025-01-01 18:00:00",
"user_id": 1,
"staff_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Vehicle booking created successfully",
"data": {
"id": 1,
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": null,
"user_id": 1,
"staff_id": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specified vehicle booking.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicle booking retrieved successfully",
"data": {
"id": 1,
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": "2025-01-01 18:00:00",
"user_id": 1,
"staff_id": null,
"vehicle": {
"id": 1,
"vehicle_name": "Toyota Hilux"
},
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified vehicle booking.
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"vehicle_id\": 1,
\"datetime_booking\": \"2025-01-01 10:00:00\",
\"datetime_return\": \"2025-01-01 18:00:00\",
\"user_id\": 1,
\"staff_id\": 1
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": "2025-01-01 18:00:00",
"user_id": 1,
"staff_id": 1
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'vehicle_id' => 1,
'datetime_booking' => '2025-01-01 10:00:00',
'datetime_return' => '2025-01-01 18:00:00',
'user_id' => 1,
'staff_id' => 1,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16'
payload = {
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": "2025-01-01 18:00:00",
"user_id": 1,
"staff_id": 1
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicle booking updated successfully",
"data": {
"id": 1,
"vehicle_id": 1,
"datetime_booking": "2025-01-01 10:00:00",
"datetime_return": "2025-01-01 18:00:00",
"user_id": 1,
"staff_id": null,
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the specified vehicle booking.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicle-bookings/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicle booking deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Vehicle Management
Get all vehicles.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/vehicles?search=ABC123&status=available&per_page=10" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicles"
);
const params = {
"search": "ABC123",
"status": "available",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicles';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'search' => 'ABC123',
'status' => 'available',
'per_page' => '10',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicles'
params = {
'search': 'ABC123',
'status': 'available',
'per_page': '10',
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicles retrieved successfully",
"data": [
{
"id": 1,
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Store a newly created vehicle.
requires authentication
Example request:
curl --request POST \
"https://megacessdemo.megacess.com/api/v1/vehicles" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"vehicle_name\": \"Toyota Hilux\",
\"plate_number\": \"ABC1234\",
\"status\": \"available\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicles"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicles';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'vehicle_name' => 'Toyota Hilux',
'plate_number' => 'ABC1234',
'status' => 'available',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicles'
payload = {
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Example response (201, Success):
{
"success": true,
"message": "Vehicle created successfully",
"data": {
"id": 1,
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Display the specified vehicle.
requires authentication
Example request:
curl --request GET \
--get "https://megacessdemo.megacess.com/api/v1/vehicles/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicles/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicles/16';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicles/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicle retrieved successfully",
"data": {
"id": 1,
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update the specified vehicle.
requires authentication
Example request:
curl --request PUT \
"https://megacessdemo.megacess.com/api/v1/vehicles/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"vehicle_name\": \"Toyota Hilux\",
\"plate_number\": \"ABC1234\",
\"status\": \"available\"
}"
const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicles/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicles/16';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'vehicle_name' => 'Toyota Hilux',
'plate_number' => 'ABC1234',
'status' => 'available',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicles/16'
payload = {
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available"
}
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicle updated successfully",
"data": {
"id": 1,
"vehicle_name": "Toyota Hilux",
"plate_number": "ABC1234",
"status": "available",
"created_at": "2025-01-01T00:00:00.000000Z",
"updated_at": "2025-01-01T00:00:00.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Remove the specified vehicle.
requires authentication
Example request:
curl --request DELETE \
"https://megacessdemo.megacess.com/api/v1/vehicles/16" \
--header "Authorization: Bearer {YOUR_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://megacessdemo.megacess.com/api/v1/vehicles/16"
);
const headers = {
"Authorization": "Bearer {YOUR_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$url = 'https://megacessdemo.megacess.com/api/v1/vehicles/16';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://megacessdemo.megacess.com/api/v1/vehicles/16'
headers = {
'Authorization': 'Bearer {YOUR_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()Example response (200, Success):
{
"success": true,
"message": "Vehicle deleted successfully"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.