Huawei E5186 AJAX API
Monday, March 16. 2015
As I wrote in my E5186 review, there is a very good API for accessing the box.
All responses start with a <?xml version="1.0" encoding="UTF-8"?>. API-calls have <response> as the root element, config-calls have <config> as the root element. Some of the API-calls can be set (POST) or get (GET). Config cannot be set (POST), only read (GET).
URI |
GET / |
Login only |
Description | Sample |
---|---|---|---|---|
/config/global/config.xml | GET | Config |
<homepage/> |
|
/config/global/net-type.xml | GET | Config ? | <networktypes><index>001</index> <networktype></networktype></networktypes> <networktypes><index>002</index> <networktype></networktype></networktypes> <networktypes><index>003</index> <networktype></networktype></networktypes> <networktypes><index>004</index> <networktype></networktype></networktypes> <networktypes><index>005</index> <networktype></networktype></networktypes> <networktypes><index>006</index> <networktype></networktype></networktypes> <networktypes><index>007</index> <networktype></networktype></networktypes> <networktypes><index>008</index> <networktype></networktype></networktypes> <networktypes><index>009</index> <networktype></networktype></networktypes> <networktypes><index>010</index> <networktype></networktype></networktypes> <networktypes><index>011</index> <networktype></networktype></networktypes> <networktypes><index>012</index> <networktype></networktype></networktypes> <networktypes><index>013</index> <networktype></networktype></networktypes> <networktypes><index>015</index> <networktype></networktype></networktypes> <networktypes><index>017</index> <networktype></networktype></networktypes> <networktypes><index>018</index> <networktype></networktype></networktypes> <networktypes><index>019</index> <networktype></networktype></networktypes> <networktypes><index>021</index> <networktype></networktype></networktypes> <networktypes><index>022</index> <networktype></networktype></networktypes> <networktypes><index>023</index> <networktype></networktype></networktypes> <networktypes><index>024</index> <networktype></networktype></networktypes> <networktypes><index>025</index> <networktype></networktype></networktypes> <networktypes><index>026</index> <networktype></networktype></networktypes> <networktypes><index>027</index> <networktype></networktype></networktypes> <networktypes><index>028</index> <networktype></networktype></networktypes> <networktypes><index>029</index> <networktype></networktype></networktypes> <networktypes><index>030</index> <networktype></networktype></networktypes> <networktypes><index>031</index> <networktype></networktype></networktypes> <networktypes><index>032</index> <networktype></networktype></networktypes> <networktypes><index>033</index> <networktype></networktype></networktypes> <networktypes><index>034</index> <networktype></networktype></networktypes> <networktypes><index>035</index> <networktype></networktype></networktypes> <networktypes><index>036</index> <networktype></networktype></networktypes> <networktypes><index>041</index> <networktype></networktype></networktypes> <networktypes><index>042</index> <networktype></networktype></networktypes> <networktypes><index>043</index> <networktype></networktype></networktypes> <networktypes><index>044</index> <networktype></networktype></networktypes> <networktypes><index>045</index> <networktype></networktype></networktypes> <networktypes><index>046</index> <networktype></networktype></networktypes> <networktypes><index>061</index> <networktype></networktype></networktypes> <networktypes><index>062</index> <networktype></networktype></networktypes> <networktypes><index>063</index> <networktype></networktype></networktypes> <networktypes><index>064</index> <networktype></networktype></networktypes> <networktypes><index>065</index> <networktype></networktype></networktypes> <networktypes><index>101</index> <networktype></networktype></networktypes> |
|
/config/pcassistant/config.xml | GET | <!-- 特性开关(要增加这个开关,与其他模块统一) --> <enable>0</enable>
<!-- PC助手页面链接地址 --> |
||
/config/global/languagelist.xml | GET | <languages> <!-- UI显示的语言列表 --> <language>de-de</language> <language>en-us</language> </languages> <privacy_policy_url> <default_url>http://consumer.huawei.com/en/privacy-policy/index.htm</default_url> <en_us>http://consumer.huawei.com/en/privacy-policy/index.htm</en_us> <zh_cn>http://consumer.huawei.com/cn/privacy-policy/index.htm</zh_cn> </privacy_policy_url>
<usermanual_language> |
||
/config/deviceinformation/config.xml | GET | <devicename>1</devicename> <serialnumber>0</serialnumber> <imei>1</imei> <imsi>1</imsi> <iccid>0</iccid> <msisdn>1</msisdn> <hardwareversion>1</hardwareversion> <softwareversion>1</softwareversion> <webuiversion>1</webuiversion> <macaddress1>1</macaddress1> <macaddress2>0</macaddress2> <productfamily>0</productfamily> <classify>0</classify> <wanipaddress>1</wanipaddress> <wanipv6address>0</wanipv6address> <esn>0</esn> <meid>0</meid> <pci>0</pci> <sc>0</sc> <cell_id>0</cell_id> <rsrq>0</rsrq> <rsrp>0</rsrp> <rssi>0</rssi> <sinr>0</sinr> <rscp>0</rscp> <ecio>0</ecio> |
||
/config/webuicfg/config.xml | GET | <lanipfilter> <wan>1</wan> <number>16</number> <lan_enable>1</lan_enable> <protocol_imcp>1</protocol_imcp> </lanipfilter> <specialapplication> <number>16</number> </specialapplication> <virtualserver> <number>16</number> </virtualserver> <firewallwanportpingswitch_enable>1 </firewallwanportpingswitch_enable> <urlfilter><number>16</number></urlfilter> <dialog_new_version>1</dialog_new_version> <install_processbar_enable>1 </install_processbar_enable> <install_processbar_speed>1 </install_processbar_speed> |
||
/api/cradle/status-info | GET | <cradlestatus>0</cradlestatus> <connectstatus>902</connectstatus> <connectionmode>5</connectionmode> <currenttime>0</currenttime> <macaddress>38:F8:89:38:F8:89</macaddress> <ipaddress></ipaddress> <netmask></netmask> <gateway></gateway> <primarydns></primarydns> <secondarydns></secondarydns> |
||
/api/device/autorun-version | GET | Radio hardware version? | <Version>22.001.07.00.03</Version> | |
/api/device/basic_information | GET | LTE, customer premises equipment | <productfamily>LTE</productfamily> <classify>cpe</classify> <multimode>0</multimode> |
|
/api/device/control | POST | Reboot the device | <Control>1</Control> | |
/api/device/device-feature-switch | GET | <coulometer_enabled>0</coulometer_enabled> <copyright_enabled>1</copyright_enabled> |
||
/api/device/information | GET | Android-side version information | <DeviceName>E5186s-22a</DeviceName> <SerialNumber>W</SerialNumber> <Imei>8643910</Imei> <Imsi>2</Imsi> <Iccid>8</Iccid> <Msisdn>041</Msisdn> <HardwareVersion>CL1E5175HM</HardwareVersion> <SoftwareVersion>21.298.00.00.55</SoftwareVersion> <WebUIVersion>16.100.02.00.03</WebUIVersion> <MacAddress1>38:F8:89:38:F8:89</MacAddress1> <MacAddress2></MacAddress2> <ProductFamily>LTE</ProductFamily> <Classify>cpe</Classify> <supportmode></supportmode> <workmode>LTE</workmode> |
|
/api/device/signal | GET | Cell ID and signal quality parameters: RSRQ, RSRP, RSSI, SINR, RSCP, Ec/Io | <pci>82</pci> <sc></sc> <cell_id>551</cell_id> <rsrq>-6dB</rsrq> <rsrp>-102dBm</rsrp> <rssi>-89dBm</rssi> <sinr>3dB</sinr> <rscp></rscp> <ecio></ecio> <mode>7</mode> |
|
/api/device/usb-tethering-switch | ? | |||
/api/dialup/connection | GET | <RoamAutoConnectEnable>0</RoamAutoConnectEnable> <MaxIdelTime>600</MaxIdelTime> <ConnectMode>0</ConnectMode> <MTU>1500</MTU> <auto_dial_switch>1</auto_dial_switch> |
||
/api/dialup/dial | ? | |||
/api/dialup/mobile-dataswitch | GET | <dataswitch>1</dataswitch> | ||
/api/global/module-switch | GET | Features of the router | <ussd_enabled>0</ussd_enabled> <bbou_enabled>1</bbou_enabled> <sms_enabled>1</sms_enabled> <sdcard_enabled>0</sdcard_enabled> <wifi_enabled>1</wifi_enabled> <statistic_enabled>1</statistic_enabled> <help_enabled>1</help_enabled> <stk_enabled>0</stk_enabled> <pb_enabled>0</pb_enabled> <dlna_enabled>0</dlna_enabled> <ota_enabled>0</ota_enabled> <wifioffload_enabled>0</wifioffload_enabled> <cradle_enabled>1</cradle_enabled> <multssid_enable>1</multssid_enable> <ipv6_enabled>0</ipv6_enabled> <monthly_volume_enabled>1</monthly_volume_enabled> <powersave_enabled>0</powersave_enabled> <sntp_enabled>0</sntp_enabled> <dataswitch_enabled>1</dataswitch_enabled> <ddns_enabled>0</ddns_enabled> <sambashare_enabled>0</sambashare_enabled> <poweroff_enabled>0</poweroff_enabled> <fw_macfilter_enabled>1</fw_macfilter_enabled> <ecomode_enabled>1</ecomode_enabled> <zonetime_enabled>0</zonetime_enabled> <diagnosis_enabled>1</diagnosis_enabled> <localupdate_enabled>1</localupdate_enabled> <cbs_enabled>0</cbs_enabled> <qrcode_enabled>0</qrcode_enabled> <charger_enbaled>0</charger_enbaled> |
|
/api/host/info | POST | Web-admin client information for the router | <Time>20150315223426</Time> <Timezone>GMT+02:00</Timezone> <Platform>Win32</Platform> <PlatformVer>Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0</PlatformVer> <Navigator>5.0 (Windows)</Navigator> <NavigatorVer>Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0</NavigatorVer> |
|
/api/language/current-language | GET | Selected language. There is a list of supported languages at /config/global/languagelist.xml | <CurrentLanguage>en-us</CurrentLanguage> | |
/api/monitoring/check-notifications | GET | <UnreadMessage>0</UnreadMessage> <SmsStorageFull>0</SmsStorageFull> <OnlineUpdateStatus>14</OnlineUpdateStatus> |
||
/api/monitoring/converged-status | GET | SIM info | <SimState>257</SimState> <SimLockEnable>0</SimLockEnable> <CurrentLanguage>en-us</CurrentLanguage> |
|
/api/monitoring/status | GET | <ConnectionStatus>901</ConnectionStatus> <WifiConnectionStatus></WifiConnectionStatus> <SignalStrength></SignalStrength> <SignalIcon>3</SignalIcon> <CurrentNetworkType>101</CurrentNetworkType> <CurrentServiceDomain>3</CurrentServiceDomain> <RoamingStatus>0</RoamingStatus> <BatteryStatus></BatteryStatus> <BatteryLevel></BatteryLevel> <BatteryPercent></BatteryPercent> <simlockStatus>0</simlockStatus> <WanIPAddress>37.33.207.127</WanIPAddress> <WanIPv6Address></WanIPv6Address> <PrimaryDns>62.241.198.245</PrimaryDns> <SecondaryDns>62.241.198.246</SecondaryDns> <PrimaryIPv6Dns></PrimaryIPv6Dns> <SecondaryIPv6Dns></SecondaryIPv6Dns> <CurrentWifiUser>0</CurrentWifiUser> <TotalWifiUser>64</TotalWifiUser> <currenttotalwifiuser>64</currenttotalwifiuser> <ServiceStatus>2</ServiceStatus> <SimStatus>1</SimStatus> <WifiStatus>0</WifiStatus> <CurrentNetworkTypeEx>101</CurrentNetworkTypeEx> <maxsignal>5</maxsignal> <wifiindooronly>0</wifiindooronly> <wififrequence>0</wififrequence> <classify>cpe</classify> <flymode>0</flymode> <cellroam>1</cellroam> <ltecastatus>0</ltecastatus> |
||
/api/monitoring/traffic-statistics | GET | Traffic transferred | <CurrentConnectTime>243360</CurrentConnectTime> <CurrentUpload>244020</CurrentUpload> <CurrentDownload>1135754</CurrentDownload> <CurrentDownloadRate>0</CurrentDownloadRate> <CurrentUploadRate>0</CurrentUploadRate> <TotalUpload>90688300183</TotalUpload> <TotalDownload>250205129647</TotalDownload> <TotalConnectTime>10613008</TotalConnectTime> <showtraffic>1</showtraffic> |
|
/api/net/current-plmn | GET | Public Land Mobile Network information | <State>0</State> <FullName>DNA</FullName> <ShortName>DNA</ShortName> <Numeric>24412</Numeric> <Rat>7</Rat> |
|
/api/online-update/upgrade-messagebox | GET | <messagebox>1</messagebox> | ||
/api/pin/status | GET | Extended SIM information | <SimState>257</SimState> <PinOptState>258</PinOptState> <SimPinTimes>3</SimPinTimes> <SimPukTimes>10</SimPukTimes> |
|
/api/redirection/homepage | GET | <EnableRedirection>0</EnableRedirection> <Homepage></Homepage> |
||
/api/security/bridgemode | ? | ? Enable bridge-mode | ||
/api/security/upnp | GET, POST | Query or set Universal Plug and Play setting | <UpnpStatus>1</UpnpStatus> | |
/api/sms/get-cbsnewslist | ? | |||
/api/sms/sms-list | ? | |||
/api/user/login | POST | Log in an admin-user | <Username>admin</Username> <Password>-password-hash-</Password> <password_type>4</password_type> |
|
/api/user/logout | POST | Log out an already logged in user | <Logout>1</Logout> | |
/api/user/remind | GET | <remindstate>1</remindstate> | ||
/api/user/session | ? | |||
/api/user/state-login | GET |
State = -1 no logged in user |
<State>-1</State> <Username></Username> <password_type>4</password_type> |
|
/api/ussd/get | ? | |||
/api/webserver/token | ? | Get a new security token | ||
/api/wlan/basic-settings | GET | WiFi setup information | <WifiSsid>Huawei5186_2.4</WifiSsid> <WifiChannel>9</WifiChannel> <WifiHide>0</WifiHide> <WifiCountry>ALL</WifiCountry> <WifiMode>b/g/n</WifiMode> <WifiRate>0</WifiRate> <WifiTxPwrPcnt>100</WifiTxPwrPcnt> <WifiMaxAssoc>32</WifiMaxAssoc> <WifiEnable>1</WifiEnable> <WifiFrgThrshld>2346</WifiFrgThrshld> <WifiRtsThrshld>2347</WifiRtsThrshld> <WifiDtmIntvl>1</WifiDtmIntvl> <WifiBcnIntvl>100</WifiBcnIntvl> <WifiWme>1</WifiWme> <WifiPamode>0</WifiPamode> <WifiIsolate>0</WifiIsolate> <WifiProtectionmode>1</WifiProtectionmode> <Wifioffenable>1</Wifioffenable> <Wifiofftime>600</Wifiofftime> <wifibandwidth>0</wifibandwidth> <wifiautocountryswitch>0</wifiautocountryswitch> <WifiRestart>0</WifiRestart> |
|
/api/wlan/handover-setting | ? | |||
/api/wlan/multi-security-settings | ? | |||
/api/wlan/multi-switch-settings | GET | <multissidstatus>1</multissidstatus> | ||
/api/wlan/station-information | ? | |||
/api/wlan/wifi-feature-switch | GET | WiFi features | <wifi5g_enabled>1</wifi5g_enabled> <wifiautocountry_enabled>0</wifiautocountry_enabled> <maxapnum>2</maxapnum> <isdoublechip>1</isdoublechip> <acmode_enable>1</acmode_enable> <stawpsenabled>0</stawpsenabled> <opennonewps_enable>1</opennonewps_enable> <stafrequenceenable>0</stafrequenceenable> <wifi24g_switch_enable>1</wifi24g_switch_enable> <wifi_dfs_enable>0</wifi_dfs_enable> |
|
/api/net/net-mode | GET, POST | Mode lock (2G/3G/4G), frequency lock. Bitmask with Huawei values. | <NetworkMode>03</NetworkMode> <NetworkBand>3FFFFFFF</NetworkBand> <LTEBand>800C5</LTEBand> |
|
All of the API-calls require a valid session cookie set to respond. Some commands require a logged in user for access, some don't. I won't be able to maintain this list, as I don't own an E5186, but I'll update this if I find something interesting.
Later I will publish a tool to allow full bi-directional access.
Arnaud on :
Jari Turkia on :
rvl on :
###########################
#!/usr/bin/env python
from _future_ import print_function
import requests
import re
import hashlib
import base64
def login(baseurl, username, password):
s = requests.Session()
r = s.get(baseurl + "html/index.html")
csrf_tokens = grep_csrf(r.text)
s.headers.update({
'__RequestVerificationToken': csrf_tokens[0]
})
# test token on statistics api
# r = s.get(baseurl + "api/monitoring/statistic-server")
data = login_data(username, password, csrf_tokens[0])
r = s.post(baseurl + "api/user/login", data=data)
s.headers.update({
'__RequestVerificationToken': r.headers["__RequestVerificationTokenone"]
})
return s
def reboot(baseurl, session):
s.post(baseurl + "api/device/control", data='1')
def grep_csrf(html):
pat = re.compile(r".*meta name=\"csrf_token\" content=\"(.*)\"", re.I)
matches = (pat.match(line) for line in html.splitlines())
return [m.group(1) for m in matches if m]
def login_data(username, password, csrf_token):
def encrypt(text):
m = hashlib.sha256()
m.update(text)
return base64.b64encode(m.hexdigest())
password_hash = encrypt(username + encrypt(password) + csrf_token)
return '%s%s4' % (username, password_hash)
WEB = "http://192.168.1.1/"
USERNAME = "admin"
PASSWORD = "admin"
if __name__ == "__main__":
s = login(WEB, USERNAME, PASSWORD)
reboot(WEB, s)
#########################
Jari Turkia on :
Arnaud on :
The only way to make some powerful changes seem to send AT commands.
Unfortunately, a lot of commands are proprietary and not documented.
aFriend on :
i have the E5186s-22a.
Thanks
Jari Turkia on :
Back to reality: if you are in a situation where you'll be needing reliable IPv4-addressing in your own LAN, for godssake, don't mess around with an Huawei router. That's just a cheaply-made cheap box for mobile internet access. It's not a proper server regardless of the power it has. Even a dirt cheap but yet powerful enough RasperryPi could handle that for you. It is a real server.
If your intention is to get a static address via 3G/LTE, then talk to your telco. If your problem is on the IPv6-side, then you'll definitely need a real server.
Mark on :
Jari Turkia on :
What you're describing sounds like you bricked it.
Hex on :
Jari Turkia on :
It would be possible, that E5186 auto-upgrades itself and gets bricked. I think you're the second person claiming that such a thing could happen.
Deon on :
aluRamb0 on :
Jari Turkia on :
Purnipsi on :
I have Huawei E5186 router and I am connected to Sonera's LTE-A network. (Bands 3 and 20). Is it anyhow possible to get Huawei report when LTE-A is in action? When I run command /api/net/net-mode I got following:
03 3FFFFFFF 20000800C5
Are there any clue?
I contacted Sonera and they said that they are considering for a possibility to add LTE-A/4G+ icon to the WebUI.
Jari Turkia on :
Network aquire order (4G/3G/2G): LTE
1) 2G/3G Frequency band preference:
2) 3FFFFFFF = CM_BAND_PREF_ANY
any band: 850,900,1700,1800,1900,2100 MHz
3) 4G Frequency bands used: 0x20000800C5 =
0x1: LTE BC1: 2100 MHz
0x4: LTE BC3: 1800 MHz
0x40: LTE BC7: 2600 MHz
0x80: LTE BC8: 900 MHz
0x80000: LTE BC20: 800 MHz
That has no information about LTE-A being used or not used.
Purnipsi on :
gaze on :
I just installed the latest Elisa FW (318) but it's not visible in the web UI and I can't find it in the API either.
Did Telia ever include this feature in their FW? I have not tested their latest FW as I think it is still not officially released..
Jari Turkia on :
moh on :
Jari Turkia on :
Jaap Schaap on :
Regards, Jaap
thom on :
ik ... [rest of the un-chipherable text removed]
Jari Turkia on :
Marcin on :
Valtteri Holopainen on :
/api/net/net-mode
KantiB on :
Ririshi on :
Jari Turkia on :
Absolutely you can. If you would have been kind enough to enter an email address to your comment, I would have been able to reply directly to you. Now I there is very little that I can do.
Alexander van Zandvliet on :
Can you post it here?
Jari Turkia on :
Zeeshan Memon on :
I am trying to do same but feeling little lost, I am using linux as OS, Huawei E8372 zong 4g lte dongle and node.js to write such app to send and receive smses but can't make it work easily. Can you please be nice to help or share some snippet? Thanks!
Jari Turkia on :
Wookie on :
Is there any way to enable USSD on E5577Cs-321 (or E5186)? I'm more or less tech-savvy, Linux user, can write Python/Bash. But I'm a completely woose in webdev, so I could use a little guiding.
Homayoun on :
best wishes,
epalzeo on :
i'd like with python to login to POST commands,
on huawei B528 or B525,
however, each time i issue the POST on api/user/login, with username, password encoded,
i've got errors :
[error] Failed with exception: ('Connection aborted.', BadStatusLine("''",))
or [error] Failed with exception: ('Connection aborted.', error(54, 'Connection reset by peer'))
Does those routers have different API to login ?
Thanks in davance
Jari Turkia on :
Novak on :
Amin Shirzad on :
Is there any way to make Huawei E5577Cs-321 to support VPN setup?
Thanks a lot!
MO on :
Is there a way to do the post command for the reboot, with a single command, without needing the RequestVerificationToken ?
Any help or ideas are appreciated.
Joost on :
Main reason is that I am using the B315 as a bridge only (=GUI not accessible from my LAN) and I want to configure it via the internet as well (GUI not available at all).
So I can now swtch the antenna type, check config and forward SMS (via telegram).
I am now in search for the API to switch the internet conection on the B315 over from LTE to WAN.
Any help much appreciated.
zaxeize on :
Krystian on :
Jari Turkia on :
My thinking is just to attach the two external antennas and you're golden. In B593 there is an admin-screen where antennas can be selected, but those engineers have created auto-sensing by detecting the impedance on the external connector.
Krystian on :
mlundblad on :
zaxeize on :
netgear orbi firmware update on :
Orbi firmware update on :
Flat on :
125002
http://pocket.wifi/api/webserver/SesTokInfo
gives the sessID and TokID. Can these be used or do I need to login into admin first?
anatol on :