Skip to content

Commit dc686c8

Browse files
author
Jared Hendrickson
committed
Organized and restructured interfaces endpoint, added update function to interface endpoint, increased validation to interfaces endpoint, added interface apply endpoint to apply pending interface configuration, updated interface endpoint unit test, updated docs, fixed bug that prevented interfaces from being found
1 parent 67ec692 commit dc686c8

12 files changed

Lines changed: 2160 additions & 506 deletions

File tree

README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,11 @@ There is no limit to API calls at this time but is important to note that pfSens
542542
* [Create Interfaces](#1-create-interfaces)
543543
* [Delete Interfaces](#2-delete-interfaces)
544544
* [Read Interfaces](#3-read-interfaces)
545+
* [Update Interfaces](#4-update-interfaces)
546+
547+
* [INTERFACE/APPLY](#interfaceapply)
548+
549+
* [Apply Interfaces](#1-apply-interfaces)
545550

546551
* [INTERFACE/VLAN](#interfacevlan)
547552

@@ -1641,6 +1646,7 @@ URL: https://{{$hostname}}/api/v1/interface
16411646
| prefix-6rd-v4plen | integer or string | Set the 6RD IPv4 prefix length. This is typically assigned by the ISP. Only available when `type6` is set to `6rd` |
16421647
| track6-interface | string | Set the Track6 dynamic IPv6 interface. This must be a dynamically configured IPv6 interface. You may specify either the interface's descriptive name, the pfSense ID (wan, lan, optx), or the physical interface id (e.g. igb0). Only required with `type6` is set to `track6` |
16431648
| track6-prefix-id-hex | string or integer | Set the IPv6 prefix ID. The value in this field is the (Delegated) IPv6 prefix ID. This determines the configurable network ID based on the dynamic IPv6 connection. The default value is 0. Only available when `type6` is set to `track6` |
1649+
| apply | boolean | Specify whether the Interface configuration should be applied Immediately or not (optional) |
16441650

16451651

16461652

@@ -1723,6 +1729,120 @@ URL: https://{{$hostname}}/api/v1/interface
17231729

17241730

17251731

1732+
### 4. Update Interfaces
1733+
1734+
1735+
Update an existing interface.<br><br>
1736+
1737+
_Requires at least one of the following privileges:_ [`page-all`, `page-interfaces-assignnetworkports`]
1738+
1739+
1740+
***Endpoint:***
1741+
1742+
```bash
1743+
Method: PUT
1744+
Type: RAW
1745+
URL: https://{{$hostname}}/api/v1/interface
1746+
```
1747+
1748+
1749+
1750+
***Query params:***
1751+
1752+
| Key | Value | Description |
1753+
| --- | ------|-------------|
1754+
| id | string | Specify the Interface to update. You may specify either the interface's descriptive name, the pfSense ID (wan, lan, optx), or the physical interface id (e.g. igb0) |
1755+
| if | string | Update the physical interface configured (optional) |
1756+
| descr | string | Update the descriptive name of the interface (optional) |
1757+
| enable | boolean | Enable or disable the Interface (optional) |
1758+
| spoofmac | string | Update the MAC address of the interface (optional) |
1759+
| mtu | string or integer | Update the MTU for this interface (optional) |
1760+
| mss | string or integer | Update the MSS for the this interface (optional) |
1761+
| media | string | Update the speed/duplex setting for this interface (optional) |
1762+
| type | string | Update the interface IPv4 configuration type (optional) |
1763+
| type6 | string | Update the interface IPv6 configuration type (optional) |
1764+
| ipaddr | string | Update the interface's static IPv4 address (required if `type` is set to `staticv4`) |
1765+
| subnet | string or integer | Update the interface's static IPv4 address's subnet bitmask (required if `type` is set to `staticv4`) |
1766+
| gateway | string | Update the interface network's upstream gateway. This is only necessary on WAN/UPLINK interfaces (optional) |
1767+
| ipaddrv6 | string | Update the interface's static IPv6 address (required if `type6` is set to `staticv6`) |
1768+
| subnetv6 | string or integer | Update the interface's static IPv6 address's subnet bitmask (required if `type6` is set to `staticv6`) |
1769+
| gatewayv6 | string | Update the interface network's upstream IPv6 gateway. This is only necessary on WAN/UPLINK interfaces (optional) |
1770+
| ipv6usev4iface | boolean | Enable or disable IPv6 over IPv4 uplink connection (optional) |
1771+
| dhcphostname | string | Update the IPv4 DHCP hostname. Only available when `type` is set to `dhcp` (optional) |
1772+
| dhcprejectfrom | string or array | Update the IPv4 DHCP rejected servers. You may pass values in as array or as comma seperated string. Only available when `type` is set to `dhcp` (optional) |
1773+
| alias-address | string | Update the IPv4 DHCP address alias. The value in this field is used as a fixed alias IPv4 address by the DHCP client (optional) |
1774+
| alias-subnet | string or integer | Update the IPv4 DHCP address aliases subnet (optional) |
1775+
| adv_dhcp_pt_timeout | string or integer | Update the IPv4 DHCP protocol timeout interval. Must be numeric value greater than 1 (optional) |
1776+
| adv_dhcp_pt_retry | string or integer | Update the IPv4 DHCP protocol retry interval. Must be numeric value greater than 1 (optional) |
1777+
| adv_dhcp_pt_select_timeout | string or integer | Update the IPv4 DHCP protocol select timeout interval. Must be numeric value greater than 0 (optional) |
1778+
| adv_dhcp_pt_reboot | string or integer | Update the IPv4 DHCP protocol reboot interval. Must be numeric value greater than 1 (optional) |
1779+
| adv_dhcp_pt_backoff_cutoff | string or integer | Update the IPv4 DHCP protocol backoff cutoff interval. Must be numeric value greater than 1 (optional) |
1780+
| adv_dhcp_pt_initial_interval | string or integer | Update the IPv4 DHCP protocol initial interval. Must be numeric value greater than 1 (optional) |
1781+
| adv_dhcp_config_advanced | boolean | Enable or disable the IPv4 DHCP advanced configuration options. This enables the DHCP options listed below (optional) |
1782+
| adv_dhcp_send_options | string | Update the IPv4 `send` option (optional) |
1783+
| adv_dhcp_request_options | string | Update the IPv4 `request` option (optional) |
1784+
| adv_dhcp_request_options | string | Update the IPv4 `required` option (optional) |
1785+
| adv_dhcp_option_modifiers | string | Update the IPv4 optionamodifier (optional) |
1786+
| adv_dhcp_config_file_override | boolean | Enable or disable local DHCP configuration file override (optional) |
1787+
| adv_dhcp_config_file_override_file | string | Update the custom DHCP configuration file's absolute path. This file must exist beforehand (optional) |
1788+
| dhcpvlanenable | boolean | Enable or disable DHCP VLAN prioritization (optional) |
1789+
| dhcpcvpt | string or integer | Update the DHCP VLAN priority. Must be a numeric value between 1 and 7 (optional) |
1790+
| gateway-6rd | string | Update the 6RD interface IPv4 gateway address. Only required when `type6` is set to `6rd` |
1791+
| prefix-6rd | string | Update the 6RD IPv6 prefix assigned by the ISP. Only required when `type6` is set to `6rd` |
1792+
| prefix-6rd-v4plen | integer or string | Update the 6RD IPv4 prefix length. This is typically assigned by the ISP. Only available when `type6` is set to `6rd` |
1793+
| track6-interface | string | Update the Track6 dynamic IPv6 interface. This must be a dynamically configured IPv6 interface. You may specify either the interface's descriptive name, the pfSense ID (wan, lan, optx), or the physical interface id (e.g. igb0). Only required with `type6` is set to `track6` |
1794+
| track6-prefix-id-hex | string or integer | Update the IPv6 prefix ID. The value in this field is the (Delegated) IPv6 prefix ID. This determines the configurable network ID based on the dynamic IPv6 connection. The default value is 0. Only available when `type6` is set to `track6` |
1795+
| apply | boolean | Specify whether the updates should be Immediately applied to the Interface or not (optional) |
1796+
1797+
1798+
1799+
***Body:***
1800+
1801+
```js
1802+
{
1803+
"if": "em1.3",
1804+
"descr": "asdf",
1805+
"enable": "",
1806+
"type": "staticv4",
1807+
"ipaddr": "10.250.0.1",
1808+
"subnet": "24",
1809+
"blockbogons": true
1810+
}
1811+
```
1812+
1813+
1814+
1815+
## INTERFACE/APPLY
1816+
1817+
1818+
1819+
### 1. Apply Interfaces
1820+
1821+
1822+
Apply pending interface updates. This will apply the current configuration for each interface.<br><br>
1823+
1824+
_Requires at least one of the following privileges:_ [`page-all`, `page-interfaces-assignnetworkports`]
1825+
1826+
1827+
***Endpoint:***
1828+
1829+
```bash
1830+
Method: POST
1831+
Type: RAW
1832+
URL: https://{{$hostname}}/api/v1/interface/apply
1833+
```
1834+
1835+
1836+
1837+
***Body:***
1838+
1839+
```js
1840+
{
1841+
}
1842+
```
1843+
1844+
1845+
17261846
## INTERFACE/VLAN
17271847

17281848

0 commit comments

Comments
 (0)