NetSure
™
Control Unit (NCU)
User Manual, UM1M830BNA
Spec. No: 1M830BNA, 1M830DNA Code: UM1M830BNA
Model No: M830B, M830D Revision M, May 12, 2017
Request
The request consists of the scheme (http), authority (the IP
address of the controller), the path (/data), and the query. The end
of the query can be specified by # or by the end of the URL.
Fragments are not supported.
The URL address should include /data; otherwise, it is not
processed by this feature. The URL address can contain /data? or
/data/?.
The query (input parameters) in the request starts after the
question mark (?).
There is an ampersand (&) between each field in the query.
The fields in the query can appear in any order.
The fields in the query are the starting time, the ending time, and 0
to 3 user keys. The starting time is assumed to be 4 hours before
the current time if it is not specified. It can be up to 4 hours in the
past. The ending time is assumed to be the current time if it is not
specified. It can be up to 4 hours in the past.
The starting and ending time are specified in one of two ways.
First, the time can be specified using “Unix timestamps”. The
format is the number of seconds since Jan 01, 1970 UTC. For
example, March 19, 2015 at 7:44UTC is 1426794290. The starting
and ending time using the Unix timestamp format is specified
using the field names stime and etime. The time is the local time
on the controller.
The starting and ending time can also be specified using YYYY-
MM-DD HH:MM:SS. Note that dashes (-) are used instead of
slashes ‘/’. The starting and ending time using this format is
specified using field names starttime and endtime. The time is the
local time on the controller.
The URL can include 0, 1, 2, or 3 user keys. These keys are ASCII
text (A-Z, a-z, 0-9, '-','.' '_', ‘~’), up to 16 characters in length. The
keys are specified as ukey1, ukey2, and ukey3. The query can
specify ukey3 without specifying ukey1 and ukey2.
The controller will respond to any abnormal request (two starting
times, two ending times, ending time before starting time,
unrecognized keywords, fields that are too long, etc.) with an error
response.
Response
The response to the HTTP request is provided as a CSV table. The
CSV table starts with a header line. There is one line (row) for each
of the data records.
Error responses are also returned in CSV format.
Response Title
The header line contains the title for each field, enclosed in double
quotes (“) and separated by commas. This is the format of the title
line:
“DateTime”, “Epoch Time”, “Status”, “<title1>”, “<title2>”,
“<titleN>”, “UserKey1”, ”UserKey2”, “UserKey3”
The <title> fields are the Full English Name of the samples in the
table. There is one title for each signal which is sampled. The titles
are enclosed in double quotes.
Response Data
Each row is one line. Each line is separated by a CR/LF.
There is always at least one row in the response.
The fields in the response are DateTime, EpochTime, Status,
Signal1…SignalN, Userkey1, Userkey2, Userkey3.
Fields are separated with commas. There is no space after each
comma.
The DateTime field is the sample time specified using YYYY-MM-
DD HH:MM:SS. The time is the local time on the controller. It is
not enclosed in quotes.
The Epoch Time field is the sample time as the number of seconds
since Jan 01, 1970 UTC. It is not enclosed in quotes.
The Status field is the return status of the request. The possible
values for this field are listed below. These strings are enclosed in
quotes.
“OK”
“No data in this time range.”
“The starting time and/or ending time is invalid.”
“The request is not understood.”
“Some requested signals are not available.”
The UserKey fields are the user keys, which were specified in the
input request. The user keys are returned in every row in the
response. They are always the last three columns in the response.
If a key is not present, then the data field in the output is empty.
For example, if only ukey3 is specified, the output for the keys
would be ,,<ukey3>. If no keys are specified, the output for the
keys would be ,,.
The rows in the response always include the same number of
columns (that is, the same number of comma’s). The number of
columns (comma’s) is the same whether the status is OK and data