Appendix B: WebAPI
xPico® Wi-Fi® Embedded Device Server User Guide
102
Import Configuration Group
An HTTP POST request can be sent to the device to set configuration.
Protocol:
HTTP
Method:
Post
Content-Type:
multipart/form-data
URL:
http://<hostname>/import/config
Parameters:
configrecord:
Content of configuration group in XML format.
CURL example (configuration is saved in a local file config.xml):
curl -u admin:PASSWORD http://172.19.100.125/import/config -X POST --
form configrecord=@config.xml
CURL example (configuration as part of command):
curl -u admin:PASSWORD http://172.19.100.125/import/config -X POST --
form-string 'configrecord=<?xml version="1.0" standalone="yes"?>
<!-- Automatically generated XML -->
<!DOCTYPE configrecord [
<!ELEMENT configrecord (conf)>
<!ELEMENT configgroup (con)>
<!ELEMENT configitem (value+)>
<!ELEMENT value (#PCDATA)>
<!ATTLIST configrecord version CDATA #IMPLIED>
<!ATTLIST configgroup name CDATA #IMPLIED>
<!ATTLIST configgroup instance CDATA #IMPLIED>
<!ATTLIST configitem name CDATA #IMPLIED>
<!ATTLIST configitem instance CDATA #IMPLIED>
<!ATTLIST value name CDATA #IMPLIED>
]>
<configrecord version = "0.1.0.1">
<configgroup name = "Access Point" instance = "ap0">
<configitem name = "SSID">
<value>MY DEVICE</value>
</configitem>
</configgroup>
</configrecord>'
HTTP example:
<form method="post" enctype="multipart/form-data" action="/import/
config" target="_blank">
<input name="configrecord" type="file" size="32">
<input name="submit" type="submit" value="Import Configuration">
</form>