linksys
linksys copied to clipboard
A Golang library for interacting with Linksys Smart WiFi-enabled routers using the JNAP protocol
linksys 
A Go library for interacting with Linksys Smart WiFi-enabled routers using the JNAP protocol described below.
HTTP API overview
All API requests are POST requests made to http://192.168.1.1/JNAP/. The API endpoint can be changed if 192.168.1.1 does not point to the router. The special domain LinksysSmartWIFI.com points to the router ONLY if the DNS server is still the default. If using any other DNS server, such as Google's 8.8.8.8, it will point to 54.183.80.213.
All requests contain a JSON object as the POST data. Even if the action doesn't require any parameters, the POST data must be {}. All actions below take no parameters unless otherwise documented. The Content-Type header does not matter and is assumed to be application/json.
All responses are JSON objects with two keys: output and response. The response key indicates the status of the action. A value of OK indicates the operation was successful, any other value indicates an error. When an error occurs, another field, error, may be returned.
X-JNAP-Action
Every request has an HTTP header, X-JNAP-Action, that describes the action, request, and response parameters. Every action starts with http://linksys.com/jnap/ (alternatively, http://cisco.com/jnap/ could be used, but it seems to be deprecated). The actions described below have the prefix omitted, but are required in the header. For example, if the heading below is core/GetDeviceInfo, the HTTP header X-JNAP-Action in the request will be http://linksys.com/jnap/core/GetDeviceInfo.
X-JNAP-Authorization
Most actions require authorization provided by the X-JNAP-Authorization HTTP header. The header is a basic access authentication with the username admin. An example of the value of X-JNAP-Authorization in pseudocode would be:
"Basic "+base64("admin:"+password)
For example, if the password was password, the header would be Basic YWRtaW46cGFzc3dvcmQ=
Unauthorized requests
core/GetAdminPasswordHint
This action returns the password hint.
core/GetAdminPasswordRestrictions
This action returns the restrictions for the admin password.
core/GetDeviceInfo
This action returns information about the router including the model, firmware, and a list of supported actions.
core/IsAdminPasswordDefault
This action returns whether the admin password is the default password.
devicelist/GetDevices
This action returns every device that has connected to the router (whether it is currently connected or not) with information such as it's local IP address (if currently connected), hostname, MAC addresses, device model (if detected), and operating system (if detected). Surprisingly, this action does not require authorization.
sinceRevisionan integer that, when provided, makes the response only contain devices that have connected since the specified revision.
devicelist/GetLocalDevice
This action returns the router-assigned GUID of the device performing the request.
firewall/GetALGSettings
This action returns the firewall ALG settings.
firmwareupdate/GetFirmwareUpdateStatus
This action returns the timestamp of the last time the router checked for an update.
locale/GetTimeSettings
This action returns the time zone of the router.
networkconnections/GetNetworkConnections
This action returns information associated with every connected device including its MAC address, Mbps, band (2.4GHz, 5GHz, ...), and signal decibels. Surprisingly, this action does not require authorization.
networkconnections/GetNetworkConnections2
Same as networkconnections/GetNetworkConnections, but with the radio ID.
parentalcontrol/GetParentalControlSettings
This action returns the parental controls settings, such as if it's enabled and rules.
qos/GetQoSSettings
This action returns QoS settings.
qos/GetWLANQoSSettings
This action returns WLAN QoS settings.
router/GetDHCPClientLeases
This action returns DHCP leases for every connected device.
router/GetEthernetPortConnections
This action returns ethernet port connections.
router/GetExpressForwardingSettings
This action returns whether express forwarding is enabled.
router/GetIPv6Settings
This action returns IPv6 settings.
router/GetIPv6Settings2
Same as router/GetIPv6Settings, but with more information.
router/GetLANSettings
This action returns LAN settings.
router/GetMACAddressCloneSettings
This action returns the MAC address clone settings.
router/GetRoutingSettings
This action returns routing settings.
router/GetWANStatus
This action returns information about the WAN status of the router.
router/GetWANStatus2
This action returns a bit more information than router/GetWANStatus.
router/GetWANStatus3
This action returns a bit more information than router/GetWANStatus2.
routerleds/GetRouterLEDSettings
This action returns a list of activated LEDs on the router.
routerlog/GetDHCPLogEntries
This action returns DHCP log entries.
firstEntryIndexan integerentryCountan integer
routerlog/GetIncomingLogEntries
This action returns incoming log entries.
firstEntryIndexan integerentryCountan integer
routerlog/GetLogSettings
This action returns log settings.
routerlog/GetOutgoingLogEntries
This action returns outgoing log entries.
firstEntryIndexan integerentryCountan integer
routerlog/GetSecurityLogEntries
This action returns security log entries.
firstEntryIndexan integerentryCountan integer
routermanagement/GetManagementSettings
This action returns management settings of the router.
routermanagement/GetManagementSettings2
Same as routermanagement/GetManagementSettings, but with more information.
routermanagement/GetRemoteManagementStatus
This action returns the remote management status of the router.
routerupnp/GetUPnPSettings
This action returns UPnP settings.
storage/GetPartitions
This action returns a list of external storage devices.
wirelessscheduler/GetWirelessSchedulerSettings
This action returns the hours that wireless access is permitted by parental controls.
Authorized requests
core/CheckAdminPassword
This action validates the password provided with the X-JNAP-Authorization.
core/Reboot
This action instructs the router to reboot.
core/SetAdminPassword2
This action sets the router admin password, NOT the network password.
adminPassworda string set to the passwordpasswordHinta hint viewable by anyone connected to the network
devicelist/SetDeviceProperties
This action sets properties for a specified device.
deviceIDthe device GUID assigned by the routerpropertiesToModifyan array of objects of properties to modifynamethe property to modify. known values are:urn:cisco-com:ui:qos(QoS)valuethe value to set the property- QoS
userPrioritizedprioritizes the device over other devices
- QoS
firmwareupdate/SetFirmwareUpdateSettings
This action sets the interval at which to check for updates and whether to automatically check for updates.
autoUpdateWindowan object containing information on when to check for updatesdurationMinutesinterval at which to check for updates in minutesstartMinute
updatePolicya string set toManualorAutomaticallyCheckAndInstall
firmwareupdate/UpdateFirmwareNow
This action instructs the router to perform a firmware upgrade.
guestnetwork/GetGuestRadioSettings
This action returns information about the guest network, such as if it's enabled, its SSID, and password.
guestnetwork/SetGuestRadioSettings
This action sets the settings for the guest network.
isGuestNetworkEnableda boolean that is set to true when the guest network will be enabled.maxSimultaneousGuestsan integer that is set to the maximum number of devices that are allowed to be connected to the guest network.radiosan array containing information about the networkbroadcastGuestSSIDa string containing the SSID for the guest networkguestPassworda string containing the guest passwordguestSSIDa string containing the guest SSIDisEnableda boolean that is set to true when the guest network is enabled. only takes effect whenisGuestNetworkEnabledis set to trueradioIDa string containing the radio ID. can be obtained withguestnetwork/GetGuestRadioSettings
locale/SetTimeSettings
This action sets the time zone for the router.
autoAdjustForDSTa boolean set to true when configured to automatically adjust for daylight savings timetimeZoneIDthe id for the time zone
parentalcontrol/SetParentalControlSettings
This action sets the parental controls settings.
isParentalControlEnableda boolean that is set to true when parental controls are enabledrulesan array of objects of rulesblockedURLsan array of blocked URLsdescriptiona string with no meaningisEnableda booleanmacAddressesan array of affected MAC addresseswanSchedulean object of days and restricted hourssundaya 48-length string of restricted hours. every character in the string is either a 0 or a 1. 0 means restricted and 1 means allowed. the numbers are in 30-minute intervals. for example, a value of "0101..." would restrict access from 12am-12:30am and 1am-1:30ammondaysame as sundaytuesdaysame as sundaywednesdaysame as sundaythursdaysame as sundayfridaysame as sundaysaturdaysame as sunday
routerleds/SetRouterLEDSettings
This action enables or disables LEDs on the router.
isSwitchportLEDEnableda boolean
routerlog/SetLogSettings
This action enables or disables logging.
isLoggingEnableda boolean
vlantagging/GetProfiles
This action returns VLAN tagging profiles.
vlantagging/GetVLANTaggingSettings
This action returns VLAN tagging settings.
wirelessap/GetRadioInfo
This action returns information about the main network, such as its SSID and password.
wirelessap/GetRadioInfo2
Same as wirelessap/GetRadioInfo, but with more information.
wirelessap/GetRadioInfo3
Same as wirelessap/GetRadioInfo2, but with more information.
wirelessap/SetRadioSettings3
This action sets the SSID and password for the main networks.
bandSteeringModea string set to the band steering modeisBandSteeringEnableda boolean set to true when band steering is enabledradiosan array of objects describing settings for different frequenciesradioIDthe ID of the frequencysettingsan object containing the settings of the frequencybroadcastSSIDa boolean set to false when the network is hiddenchannelchannelWidthisEnabledmodesecuritya string set to the security protocolssidwpaPersonalSettingsan object containing the passwordpassphrasea string set to the password of the network