Real Time Automation, Inc.
34
1-800-249-1612
Web Interface: XML/JSON Data Format
1)
XML
–
For simplicity, the Web Interface
uses a “flat” XML encoding format. The root XML
element is always
<Devices>
followed by one or more
<Device>
elements, which will in
turn contain name-value pairs with the data relevant to that Device.
2)
JSON
–
The format of JSON is very simplistic. Data is contained in a single array of zero or more
objects, each representing a
Device.
Each object contains one or more name/value pairs within
the Device.
Retrieving Data from the Gateway from a Web Client
XML and JSON data accessed from the 460WI using web client is handled via a standard HTTP
GET
request. Which data is to be accessed and how that data is to be encoded is all determined by the URL
supplied with the GET request. This is the same method through which web browsers retrieve web
pages so you can use the web browser of your choice to experiment with different requests by simply
typing the URL into the browser’s address bar and hitting en
ter.
Basics
To begin with, you will need to know the IP address of your Encoder Gateway. If you do not know the IP
address, refer to [IP Config Section]. The examples in this document will use 192.168.0.1 for the sake of
illustration, but your IP will likely be different.
The most basic GET request that can be sent to the 460WI encodes all of the data points configured in
the Gateway. The only option in this case is deciding how you would like the data encoded.
If you would like the data encoded as XML, enter URL:
http://192.168.0.1/gateway/xml
If you would like the data encoded as JSON, enter URL:
http://192.168.0.1/gateway/json
All data requests will begin with one of the above URL paths. Further narrowing down your data
requests involves adding additional information to the URL’s path.
Note: A common mistake is to include an extra forward slash with the request for all the data in the
Gateway (eg.
http://192.168.0.1/gateway/xml/
rather than the correct
http://192.168.0.1/gateway/xml
).
The incorrect format will result in a “404 Not Found”
error.
No data requests to the Gateway will ever end with a forward slash.
Requesting Data for an Individual Device
To request data for an individual Device that you have configured within the Gateway, you simply need
to specify the way you would like the data for the
Device
encoded as well as the name you supplied for
it. For example, the URL to request data for a
Device
named “Breaker1” encoded as XML would be:
http://192.168.0.1/gateway/xml/device/Breaker1