The information contained in this document is subject to change. This document contains proprietary information, which is protected by copyright
laws. All rights are reserved. No part of this document may be photocopied, reproduced or translated to another language or program language
without prior written consent of RFI Engineering B.V.
RefGuide_U-routerNGW_v1.01.docx
Page: 45(
57)
14.7 Relay
The ‘
relay
’ endpoints provide information on the relay status of the U-router NGW and can be
used to set or re-set the relays.
ENDPOINTS
GET /api/relay
POST /api/relay
You can use the
GET /api/relay
endpoint to retrieve the status of the connected relays.
For example:
curl https://192.168.168.1/api/relay -u rfi:rfi123
Returns:
{
"items": [{
"id": "0",
"description": "Internal relay is not used",
"relayState": "OFF",
"rpswState": "RPSW Disconnected"
}, {
"id": "fa0002",
"rpswState": "RS485 Remote Power Switch - Single Port [0.04]",
"description": "Power to Ethernet Switch #02",
"relayState": "ON"
}, {
"id": "fa0003",
"rpswState": "RS485 Remote Power Switch - Single Port [0.04]",
"description": "Power to Cisco Router",
"relayState": "ON"
}],
"status": "OK"
}
One or, more relays are returned, where each relay is identified by its ‘id’. On every U-router NGW
the internal relay has id #0. When intelligent Remote Power Switches are connected (running the
RIOT protocol) the ‘id’ of the Remote Power Switch is shown.
You can use the POST /api/relay endpoint to set the status of the connected relays.
For example:
curl -X POST https://192.168.168.1/api/relay -u rfi:rfi123 -d "id=0&relayState=ON"
Returns:
{
"status": "OK"
}
In the example above the internal relay is turned ON. You can also turn the relay OFF.
When the relay is not found by ‘id’ an http status code 400 and error object is returned.
{
"status": "error",
"message": "Relay with ID '{fa0022}' not found"
}