Mag Me-Acs Web API Application Note v1.8
Mag Me-Acs Web API Application Note v1.8
Software API
WWW.MAG-ETEGRA.COM.MY
MAG APPLICATION NOTE - MAG ETEGRA SOFTWARE API
Version: V1.6
1.6 10 October 2023 Added API Endpoint for Get user, Get
face and Get list of user id
1.7 17 October 2023 Added API Endpoint for Get face
permissions
API Endpoints
Departments
Get departments GET
Designations
Get designations GET
Branches
Get branches GET
Doors
Get doors GET
Door Groups
Get door groups GET
Update door group POST
Delete door group DELETE
Time zones
Get time zones GET
Update time zone POST
Delete time zone DELETE
Users
Create user POST
Update user PUT
Delete user DELETE
Set face PUT
Get face GET
Update face permissions PUT
Get face permissions GET
Delete face DELETE
Get user GET
Get list of user id GET
Devices
Upload user POST
Set door POST
Events
Get events GET
Get departments
HTTP Method: GET
URL: /api/departments
Description: Returns a list of all departments
Sample Responses:
200 OK
[
{
"id": 1,
"name": "Account"
},
{
"id": 2,
"name": "IT"
}
]
Response Fields:
Parameter Name Description
id Department id
name Department name
Get designations
HTTP Method: GET
URL: /api/designations
Description: Returns a list of all designations
Sample Responses:
200 OK
[
{
"id": 1,
"name": "Visitor"
},
{
"id": 2,
"name": "Contractor"
}
]
Response Fields:
Parameter Name Description
id Designation id
name Designation name
Get branches
HTTP Method: GET
URL: /api/branches
Description: Returns a list of all branches
Sample Responses:
200 OK
[
{
"id": 1,
"name": "HQ"
},
{
"id": 2,
"name": "JB"
}
]
Response Fields:
Parameter Name Description
id Branch id
name Branch name
Get doors
HTTP Method: GET
URL: /api/doors
Description: Returns a list of all doors
Sample Responses:
200 OK
[
{
"door_id": "1.0.1",
"door_status": 0
},
{
"door_id": "1.0.2",
"door_status": 1
},
{
"door_id": "1.0.4",
"door_status": 2
}
]
Response Fields:
Parameter Name Description
door_id Door id
door_status Door status
Valid values are:
• 0: Offline
• 1: Online
• 2: Disabled
Sample Responses:
200 OK
[
{
"id": 1,
"name": "DG1",
"doors": [
"6.0.1"
]
},
{
"id": 2,
"name": "DG2",
"doors": [
"1.0.11",
"1.0.12"
]
}
]
Response Fields:
Parameter Name Description
id Door group id
name Door group name
doors List of doors
Request Parameters:
Parameter Name Description Required Type
group_name Door group name Y string
group_doors List of doors N string array
Request Body:
{
"group_name": "Account",
"group_doors": [
"7.0.1",
"7.0.3"
]
}
Sample Responses:
204 No Content
Resource Parameter:
Parameter Name Description Required Type
name Door group name Y string
Sample Responses:
204 No Content
Sample Responses:
200 OK
[
{
"id": 1,
"name": "TZ1",
"sun_allowed": false,
"sun_start": "00:00:00",
"sun_end": "00:00:00",
"mon_allowed": true,
"mon_start": "16:05:00",
"mon_end": "16:10:00",
"tue_allowed": false,
"tue_start": "00:00:00",
"tue_end": "00:00:00",
"wed_allowed": false,
"wed_start": "00:00:00",
"wed_end": "00:00:00",
"thu_allowed": false,
"thu_start": "00:00:00",
"thu_end": "00:00:00",
"fri_allowed": false,
"fri_start": "00:00:00",
"fri_end": "00:00:00",
"sat_allowed": false,
"sat_start": "00:00:00",
"sat_end": "00:00:00",
"holiday_allowed": false
}
]
Response Fields:
Parameter Name Description
id Time zone id
name Time zone name
sun_allowed Allowed to enter on Sunday
Request Parameters:
Parameter Name Description Required Type
name Time zone name Y string
sun_allowed Allowed to enter on Sunday Y boolean
sun_start Start time Y timespan
sun_end End time Y timespan
mon_allowed Allowed to enter on Monday Y boolean
mon_start Start time Y timespan
mon_end End time Y timespan
tue_allowed Allowed to enter on Tuesday Y boolean
tue_start Start time Y timespan
tue_end End time Y timespan
wed_allowed Allowed to enter on Wednesday Y boolean
wed_start Start time Y timespan
wed_end End time Y timespan
thu_allowed Allowed to enter on Thursday Y boolean
thu_start Start time Y timespan
thu_end End time Y timespan
fri_allowed Allowed to enter on Friday Y boolean
fri_start Start time Y timespan
fri_end End time Y timespan
sat_allowed Allowed to enter on Saturday Y boolean
sat_start Start time Y timespan
sat_end End time Y timespan
holiday_allowed Allowed to enter during holiday Y boolean
Request Body:
{
"name": "TZ1",
"sun_allowed": false,
"sun_start": "00:00:00",
"sun_end": "00:00:00",
"mon_allowed": true,
"mon_start": "16:05:00",
"mon_end": "16:10:00",
"tue_allowed": false,
"tue_start": "00:00:00",
"tue_end": "00:00:00",
"wed_allowed": false,
"wed_start": "00:00:00",
"wed_end": "00:00:00",
"thu_allowed": false,
"thu_start": "00:00:00",
© 2023 ME-ACS Software API 15
MAG APPLICATION NOTE - MAG ETEGRA SOFTWARE API
"thu_end": "00:00:00",
"fri_allowed": false,
"fri_start": "00:00:00",
"fri_end": "00:00:00",
"sat_allowed": false,
"sat_start": "00:00:00",
"sat_end": "00:00:00",
"holiday_allowed": false
}
Sample Responses:
204 No Content
Request Parameters:
Parameter Name Description Required Type
doors List of doors Y string array
Request Body:
{
"doors": [
"7.0.3"
]
}
Sample Responses:
200 OK
[
{
"door_id": "7.0.3",
"error": false,
"message": "Success"
}
]
Response Fields:
Parameter Name Description
door_id Door id
error Valid values are:
true: failure
false: success
message Upload status message
Resource Parameter:
Parameter Name Description Required Type
name Time zone name Y string
Sample Responses:
204 No Content
Create user
HTTP Method: POST
URL: /api/users
Description: Creates a new user
Request Parameters:
Parameter Name Description Required Type
user_id User id Y string
user_name Name Y string
designation Designation Y integer
department Department Y integer
branch Branch N integer
guard_patrol Guard patrol N boolean
skip_fp Skip fingerprint check N boolean
skip_card Skip card check N boolean
exp_end_enabled Enable expiry ending date Y boolean
exp_end_date Expiry ending date N string/date
exp_start_enabled Enable start valid date Y boolean
exp_start_date Start valid date N string/date
alias Alias N string
car_id Car id N string
legal_id Legal id N string
address_1 Address 1 N string
address_2 Address 2 N string
address_3 Address 3 N string
address_4 Address 4 N string
tel_no Tel N string
mobile_no Mobile N string
email Email N string
gender Gender N string
Valid values are:
• Blank
• M: Male
• F: Female
birth_date Birth date N string/date
start_date Start date N string/date
is_admin Admin control for Face Reader Menu N boolean
Request Body:
{
"user_id": "TESTER001",
"user_name": "TESTER 1",
"department": 2,
"designation": 1,
"branch_id": 1,
"guard_patrol": true,
"skip_fp": true,
"skip_card": true,
"exp_end_enabled": true,
Sample Responses:
201 Created
Response Headers
content-length: 0
date: Mon,19 Jun 2023 08:48:52 GMT
location: https://localhost/api/users/tester001
server: Kestrel
Update user
HTTP Method: PUT
URL: /api/users/{id}
Description: Updates a user
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Request Parameters:
Parameter Name Description Required Type
user_name Name Y string
designation Designation Y integer
department Department Y integer
branch Branch N integer
guard_patrol Guard patrol N boolean
skip_fp Skip fingerprint check N boolean
skip_card Skip card check N boolean
exp_end_enabled Enable expiry ending date Y boolean
exp_end_date Expiry ending date N string/date
exp_start_enable Enable start valid date Y boolean
d
exp_start_date Start valid date N string/date
alias Alias N string
car_id Car id N string
legal_id Legal id N string
address_1 Address 1 N string
address_2 Address 2 N string
address_3 Address 3 N string
address_4 Address 4 N string
tel_no Tel N string
mobile_no Mobile N string
email Email N string
gender Gender N string
Valid values are:
• Blank
• M: Male
• F: Female
birth_date Birth date N string/date
start_date Start date N string/date
is_admin Admin control for Face Reader Menu N boolean
Request Body:
{
"user_name": "TESTER 1",
"department": 2,
"designation": 1,
"branch_id": 1,
Sample Responses:
200 OK
{
"user_id": "TESTER001",
"user_name": "TESTER 1",
"department": 2,
"designation": 1,
"branch": null,
"guard_patrol": true,
"skip_fp": true,
"skip_card": true,
"exp_end_enabled": true,
"exp_end_date": "2033-06-01T08:41:53.241Z",
"exp_start_enabled": true,
"exp_start_date": "2023-06-01T08:41:53.241Z",
"alias": "",
"car_id": "",
"legal_id": "",
"address_1": "",
"address_2": "",
"address_3": "",
"address_4": "",
"tel_no": "",
"mobile_no": "",
"email": "",
"gender": "",
"birth_date": "2003-06-19T08:41:53.241Z",
"start_date": "2023-06-19T08:41:53.241Z",
"is_admin": true,
"created_by": "ADMIN",
"date_created": "2023-06-19T16:43:54.36",
"modified_by": "ADMIN",
"date_modified": "2023-06-19T17:07:14.802236+08:00"
}
Set face
HTTP Method: PUT
URL: /api/users/{id}/set_face
Description: Updates face
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Request Parameter:
Parameter Name Description Required Type
file_bytes The image file to upload Y byte array
File type: jpg
Recommended image size: 480 x 640
Request Body:
{
"file_bytes":
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAB2AAAAdgFOeyYIAAAAGXRFWHRTb2Z0d
2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAOpJREFUOI2t0ktKQ0EQheHPO5AsQhBBguAKfEzENYi4BAm4B92CuAg
1F1xB3IEx4gocGo2KI/GBgy6DXPtqDzzQgz5d9Vd1d5FXF3084wk1Flpif2gJ97jCHnZxEV4RpI7kzjevgyFOSwB3U
bmpHh6aZpUJnMVrC/yjpINaunPzCpc4LgF0pQcbSg/Yi+QxFksAMBfVHiPxJMD/r5kWfx5bWI79tfSFN38BKxzgBbc
YxBqHty//c1MdYYLtRmCFHWkODtuSN/GGlV8KrOMdG7nDM2WjWseatvalVZwXAAZYywEmGBUARtJ8gE9LJjMHnxa8C
wAAAABJRU5ErkJggg=="
}
Sample Responses:
204 No Content
Get face
HTTP Method: GET
URL: /api/users/{id}/get_face
Description: Gets face
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Request Body:
Sample Responses:
200 OK
{
"file_bytes":
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAB2AAAAdgFOeyYIAAAAGXRFWHRTb2Z0d
2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAOpJREFUOI2t0ktKQ0EQheHPO5AsQhBBguAKfEzENYi4BAm4B92CuAg
1F1xB3IEx4gocGo2KI/GBgy6DXPtqDzzQgz5d9Vd1d5FXF3084wk1Flpif2gJ97jCHnZxEV4RpI7kzjevgyFOSwB3U
bmpHh6aZpUJnMVrC/yjpINaunPzCpc4LgF0pQcbSg/Yi+QxFksAMBfVHiPxJMD/r5kWfx5bWI79tfSFN38BKxzgBbc
YxBqHty//c1MdYYLtRmCFHWkODtuSN/GGlV8KrOMdG7nDM2WjWseatvalVZwXAAZYywEmGBUARtJ8gE9LJjMHnxa8C
wAAAABJRU5ErkJggg=="
}
Response Fields:
Parameter Name Description
file_bytes The image file
File type: jpg
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Request Parameters:
Parameter Name Description Required Type
access_mode Access mode Y integer
Valid values are:
0: Invalid access
1: Normal access
door_group Door group name N string
*Door vs time zone must be empty
*Lift door vs floor must be empty
timezone Time zone name N string
NULL or EMPTY: Free zone
*Door vs time zone must be empty
*Lift door vs floor must be empty
doors_vs_timezones Door vs time zone N refer to
*Door group must be empty Door vs
*Time zone must be empty time zone
Parameters
doors_vs_floors Lift door vs floor N refer to Lift
*Door group must be empty door vs
*Time zone must be empty floor
Parameters
site_code Site code N string
*ABA number must be empty
*Card code will be required field if site code has value
card_code Card code N string
*ABA number must be empty
*Site code will be required field if card code has value
aba_number ABA number N string
*Site code and card code must be empty
Request Body:
{
"access_mode": 1,
"doors_vs_timezones": [
{
"door_id": "7.0.1"
},
{
"door_id": "1.0.2",
"timezone": "TZ2"
}
],
"doors_vs_floors": [
{
"door_id": "1.0.1",
"floors": [1, 2, 3]
}
],
"site_code": "123",
"card_code": "456",
}
Sample Responses:
204 No Content
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Request Body:
Sample Responses:
200 OK
{
"access_mode": 1,
"door_group": null,
"timezone": null,
"doors_vs_floors": [
{
"door_id": "7.0.1",
"floors": [
1,
2,
3
]
}
],
"doors_vs_timezones": [
{
"door_id": "7.0.1",
"timezone": null
},
{
"door_id": "7.0.2",
"timezone": "TZ2"
}
],
"site_code": "100",
"card_code": "12345",
"aba_number": "0006565945"
}
Response Fields:
Parameter Name Description
access_mode Access mode
Valid values are:
0: Invalid access
1: Normal access
door_group Door group name
timezone Time zone name
NULL or EMPTY: Free zone
doors_vs_timezones Door vs time zone
Delete user
HTTP Method: DELETE
URL: /api/users/{id}
Description: Deletes a user (including face and permissions)
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Sample Responses:
204 No Content
Delete face
HTTP Method: DELETE
URL: /api/users/{id}/delete_face
Description: Deletes a face
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Sample Responses:
204 No Content
Get user
HTTP Method: GET
URL: /api/users/{id}
Description: Gets user details
Resource Parameter:
Parameter Name Description Required Type
id User id Y string
Sample Responses:
200 OK
{
"user_id": "TESTER001",
"user_name": "TESTER 1",
"department": 0,
"designation": 0,
"branch": null,
"guard_patrol": false,
"skip_fp": false,
"skip_card": true,
"exp_end_enabled": false,
"exp_end_date": "2033-06-01T00:00:00",
"exp_start_enabled": false,
"exp_start_date": "2023-06-01T00:00:00",
"alias": null,
"car_id": null,
"legal_id": null,
"address_1": null,
"address_2": null,
"address_3": null,
"address_4": null,
"tel_no": null,
"mobile_no": null,
"email": null,
"gender": "",
"birth_date": "2022-06-16T00:00:00",
"start_date": "2022-06-16T00:00:00",
"is_admin": false,
"created_by": "ADMIN",
"date_created": "2022-06-16T19:10:43",
"modified_by": "ADMIN",
"date_modified": "2023-04-16T19:03:17.38"
}
Response Fields:
Parameter Name Description
user_id User id
user_name Name
designation Designation
department Department
branch Branch
guard_patrol Guard patrol
skip_fp Skip fingerprint check
skip_card Skip card check
exp_end_enabled Enable expiry ending date
exp_end_date Expiry ending date
exp_start_enabled Enable start valid date
exp_start_date Start valid date
alias Alias
car_id Car id
legal_id Legal id
address_1 Address 1
address_2 Address 2
address_3 Address 3
address_4 Address 4
tel_no Tel
mobile_no Mobile
email Email
gender Gender
Valid values are:
• Blank
• M: Male
• F: Female
birth_date Birth date
start_date Start date
is_admin Admin control for Face Reader Menu
Sample Responses:
200 OK
[
"TESTER001",
"TESTER002",
"TESTER003"
]
Upload user
HTTP Method: POST
URL: /api/devices/uploaduser
Description: Uploads user
Request Parameters:
Parameter Name Description Required Type
users List of users Y string array
doors List of doors Y string array
Request Body:
{
"users": [
"8"
],
"doors": [
"7.0.3"
]
}
Sample Responses:
200 OK
[
{
"door_id": "7.0.3",
"user_id": "8",
"error": false,
"message": "Success"
}
]
Response Fields:
Parameter Name Description
door_id Door id
user_id User id
error Valid values are:
true: failure
false: success
message Upload status message
Set door
HTTP Method: POST
URL: /api/devices/setdoor
Description: Locks or unlocks door
Request Parameters:
Parameter Name Description Required Type
door_id Door id Y string
door_command Door command Y int
Valid values are:
0: unlock
1: lock
Request Body:
{
"door_id": "7.0.3",
"door command": 0
}
Sample Responses:
200 OK
{
"door_id": "7.0.3",
"door_status": 0
}
Response Fields:
Parameter Name Description
door_id Door id
door_status Door status
0: unlocked
1: locked
Request Parameters:
Parameter Name Description Required Type
doors List of doors Y string array
Request Body:
{
"doors": [
"7.0.3"
]
}
Sample Responses:
200 OK
[
{
"door_id": "7.0.3",
"error": false,
"message": "Success"
}
]
Response Fields:
Parameter Name Description
door_id Door id
error Valid values are:
true: failure
false: success
message Upload status message
Delete user
HTTP Method: POST
URL: /api/devices/deleteuser
Description: Uploads user
Request Parameters:
Parameter Name Description Required Type
users List of users Y string array
doors List of doors Y string array
Request Body:
{
"users": [
"8"
],
"doors": [
"7.0.3"
]
}
Sample Responses:
200 OK
[
{
"door_id": "7.0.3",
"user_id": "8",
"error": false,
"message": "Success"
}
]
Response Fields:
Parameter Name Description
door_id Door id
user_id User id
error Valid values are:
true: failure
false: success
message Upload status message
Request Parameters:
Parameter Name Description Required Type
id User id Y string
door_id Door id Y string
Sample Responses:
200 OK
{
"file_bytes":
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAB2AAAAdgFOeyYIAAAAGXRFWHRTb2Z0d
2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAOpJREFUOI2t0ktKQ0EQheHPO5AsQhBBguAKfEzENYi4BAm4B92CuAg
1F1xB3IEx4gocGo2KI/GBgy6DXPtqDzzQgz5d9Vd1d5FXF3084wk1Flpif2gJ97jCHnZxEV4RpI7kzjevgyFOSwB3U
bmpHh6aZpUJnMVrC/yjpINaunPzCpc4LgF0pQcbSg/Yi+QxFksAMBfVHiPxJMD/r5kWfx5bWI79tfSFN38BKxzgBbc
YxBqHty//c1MdYYLtRmCFHWkODtuSN/GGlV8KrOMdG7nDM2WjWseatvalVZwXAAZYywEmGBUARtJ8gE9LJjMHnxa8C
wAAAABJRU5ErkJggg=="
}
Response Fields:
Parameter Name Description
file_bytes The image file
File type: jpg
Get events
HTTP Method: GET
URL: /api/events
Description: Returns a list of events
Request Parameters:
Parameter Name Description Required Type
start Start datetime Y string/datetime
end End datetime Y string/datetime
user_id User id N string
Sample Responses:
200 OK
[
{
"id": 535391,
"time": "2023-06-21T11:04:18",
"user_id": "8",
"user_name": "Marcus",
"department ": "Account",
"door_id": "7.0.3",
"door_name": "7.0.3 - FR320",
"event": "Normal access by face"
}
]
Response Fields:
Parameter Name Description
id Event id
time Event date time
user_id User id
user_name User name
department Department
door_id Door id
door_name Door name
event Event description
*Product performances is based on testing in a controlled environment. Your result may vary due
to several external and environment factors.
©COPYRIGHT 2023.This documentation served as a reference only. It is subject to change without further notice. All the diagrams and information
in this documentation may not be duplicated or modified in any form without the written approval from the management.