Remotely opening a door and turnstile
To remotely open a door, or allow the turning of a turnstile, you will need to use the endpoint execute actions
described below.
Execute action
Executes an action from the device. The HTTP method used is POST. Check the example at the bottom of this page to see how to use it.
POST /execute_actions.fcgi
Parameters
- actions (array of JSON objects): Each element of this array has 2 keys, both strings: action and parameters. Action is an action to be performed and parameters are the parameters of this action.
- action (string): Action to be performed, the available actions are:
- door: Action for opening doors.
- sec_box: Action to open doors on devices that use the external drive module (SecBox).
- open_collector: Action to open the collector ( ballot box) of the iDBlock turnstile.
- catra: Action to release the turnstile to either or both sides.
- parameters (string): Parameters of the above actions, in further detail in the examples below.
Response
- This request has no response.
Example Open Relay iDAccess/iDFit/iDBox/iDUHF:
$.ajax({
url: "/execute_actions.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
actions: [ { action: "door", parameters: "door=1" } ]
})
});
Example Open Relay iDFlex/iDAccess Pro/iDAccess Nano/iDUHF:
$.ajax({
url: "/execute_actions.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
actions: [ { action: "sec_box", parameters: "id=65793, reason=3" } ]
})
});
Example Open collector (ballot box) turnstile
Opens the iDBlock collector (ballot box), does not receive any parameters:
$.ajax({
url: "/execute_actions.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
actions: [ { action: "open_collector", parameters: "" } ]
})
});
Releases the turnstile to one side
This action gets a parameter (allow="direction"), where "direction" must be "anticlockwise", "clockwise" or "both". The turnstile will be released anti-clockwise, clockwise, or both, respectively. The example below releases the turnstile in a clockwise direction:
$.ajax({
url: "/execute_actions.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
actions: [ { action: "catra", parameters: "allow=clockwise" } ]
})
});
Activates the turnstile relays
This action gets a "relay" parameter, which must be "1" or "2".
$.ajax({
url: "/execute_actions.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
actions: [ { action: "catra", parameters: "relay=1" } ]
})
});
Check equipment door state (open / close)
This operation is used to obtain the status of the equipment's door (open / close). The HTTP method used for this operation is POST.
POST /door_state.fcgi
Parameters
- This request does not require any parameters.
Responses examples:
Devices with SecBox connected:
"sec_boxes": [
{
"id": 122641794705017745,
"open": false
},
{
"id": 65793,
"open": false
}
]
Devices with relays connected:
"doors": [
{
"id": 1,
"open": false
},
{
"id": 2,
"open": false
}
]
Device with no relay connected:
"error" : "Sec Box count message parameter is invalid",
"code" : 1
Example of request
$.ajax({
url: "/doors_state.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({})
});