Switch¶
The Switch API allow you to control the settings of the Freebox integrated switch.
Switch Errors¶
When attempting to access the switch API, you may encounter the following errors:
| error_code | Description |
|---|---|
| bad_port | invalid port number |
| bad_speed | unable to set port speed |
| bad_link | unable to set port link mode |
| bad_mac_entry_type | invalid mac entry type |
Switch Port Status Object¶
SwitchPortStatus has the following attributes:
-
SwitchPortStatus¶ -
idint Read-only¶ switch port id
-
linkenum Read-only¶ link Description up port is up down port is down
-
duplexenum¶ duplex Description half force in half duplex mode full force in full duplex mode
-
speedenum¶ duplex Description 10 10Base-T 100 100Base-TX 1000 1000Base-T
-
modestring Read-only¶ display form of speed and duplex mode
-
mac_list[] array of object Read-only¶ list of { mac, name } of hosts connected to this port
-
Switch Port Configuration Object¶
SwitchPortConfig has the following attributes:
Switch Port Stats Object [UNSTABLE]¶
SwitchPortStats has the following attributes:
-
SwitchPortStats¶ -
rx_bad_bytesint Read-only¶
-
rx_broadcast_packetsint Read-only¶
-
rx_bytes_rateint Read-only¶
-
rx_err_packetsint Read-only¶
-
rx_fcs_packetsint Read-only¶
-
rx_fragments_packetsint Read-only¶
-
rx_good_bytesint Read-only¶
-
rx_good_packetsint Read-only¶
-
rx_jabber_packetsint Read-only¶
-
rx_multicast_packetsint Read-only¶
-
rx_oversize_packetsint Read-only¶
-
rx_packets_rateint Read-only¶
-
rx_pauseint Read-only¶
-
rx_undersize_packetsint Read-only¶
-
rx_unicast_packetsint Read-only¶
-
tx_broadcast_packetsint Read-only¶
-
tx_bytesint Read-only¶
-
tx_bytes_rateint Read-only¶
-
tx_collisionsint Read-only¶
-
tx_deferredint Read-only¶
-
tx_excessiveint Read-only¶
-
tx_fcsint Read-only¶
-
tx_lateint Read-only¶
-
tx_multicast_packetsint Read-only¶
-
tx_multipleint Read-only¶
-
tx_packetsint Read-only¶
-
tx_packets_rateint Read-only¶
-
tx_pauseint Read-only¶
-
tx_singleint Read-only¶
-
tx_unicast_packetsint Read-only¶
-
Switch API¶
Get the current switch status¶
-
GET/api/v4/switch/status/¶ Return the list of swith port status
SwitchPortStatusExample request:
GET /api/v4/switch/status/ HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": [ { "duplex": "half", "link": "down", "id": 3, "mode": "10BaseT-HD", "speed": "10" }, { "duplex": "full", "link": "up", "id": 1, "mode": "1000BaseT-FD", "speed": "1000" }, { "duplex": "half", "link": "down", "id": 2, "mode": "10BaseT-HD", "speed": "10" }, { "duplex": "full", "mac_list": [ { "mac": "00:24:D4:7E:00:4C", "hostname": "r0ro's player" } ], "link": "up", "id": 4, "mode": "1000BaseT-FD", "speed": "1000" } ] }
Get a port configuration¶
-
GET/api/v4/switch/port/{id}¶ Get the
SwitchPortConfigfor the given port idExample request:
GET /api/v4/switch/port/1 HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": { "id": 1, "speed": "auto", "duplex": "auto" } }
Update a port configuration¶
-
PUT/api/v4/switch/port/{id}¶ Update the
SwitchPortConfigfor the given port idExample request:
PUT /api/v4/switch/port/1 HTTP/1.1 Host: mafreebox.freebox.fr
{ "speed": "10" }
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": { "id": 4, "speed": "10", "duplex": "auto" } }
Get a port stats¶
-
GET/api/v4/switch/port/{id}/stats¶ Get the
SwitchPortStatsfor the given port idExample request:
GET /api/v4/switch/port/4/stats HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, "result": { "rx_packets_rate": 4, "rx_good_bytes": 20018805, "rx_oversize_packets": 0, "rx_unicast_packets": 113034, "tx_bytes_rate": 736, "tx_unicast_packets": 112409, "rx_bytes_rate": 608, "tx_packets": 166266, "tx_collisions": 0, "tx_packets_rate": 6, "tx_fcs": 0, "tx_bytes": 25316860, "rx_jabber_packets": 0, "tx_single": 0, "tx_excessive": 0, "rx_pause": 0, "rx_multicast_packets": 1217, "tx_pause": 0, "rx_good_packets": 114296, "rx_broadcast_packets": 45, "tx_multiple": 0, "tx_deferred": 0, "tx_late": 0, "tx_multicast_packets": 27962, "rx_fcs_packets": 0, "tx_broadcast_packets": 25895, "rx_err_packets": 0, "rx_fragments_packets": 0, "rx_bad_bytes": 0, "rx_undersize_packets": 0 } }