Download
The following is an example REST/JSON download request from the TFT Router:
POST /tft-download HTTP/1.0
Content-Type: application/json
Content-Length: <num>
{
"id":"user",
"pwd":"password",
"ack":1204,
"max":1000
}
There are several tools that can be used to aid in the initial development of the download POST. Below are two examples that can be used in a UNIX environment. Be sure to replace the MyUserID, MyPass, TssHost, and port with values provided by a TSS administrator. Please Note: The use of single and double quotes in the examples are likely to be important to avoid command shell issues.
The wget tool can issue a download POST similar to this example:
/bin/wget --header="Content-Type: application/json" -O - \
--post-data='{"id":"MyUserID", "pwd":"MyPass", "ack":0, "max":100}'\
TssHost:8080/tft-download
These are 3rd party tools that may also have “man” pages on your operating system. More information about the tools can be found via a web search engine. The results of the above tools are discussed in the next section.
Download Response
The following is an example REST/JSON download response from the TSSRegistry™ that includes 3 commands in a JSON event array where the next sequence number happens to be 1205 for this example. This example also indicates, that after this response is sent, the TSSRegistry queue is empty (e.g. remaining is 0).
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: <num>
Date: Tue, 13 Jan 2015 16:35:09 GMT
Connection: close
{
"events":[
{"command":"add","tfn":"8005001212","tspid":"01234","sequence":1205},
{"command":"delete","tfn":"8006001212","sequence":1206},
{"command":"add","tfn":"8007001212","tspid":"01234","sequence":1207}
], // end of events array
"remaining":0 // 0 indicates there are no more events to download
}
Please Note: For the delete command, the tspid field is intentionally omitted as it is unnecessary.
Disclaimer: Any images in this article are intended to be used as a guide for educational purposes only and they may differ slightly from the Production Environment.
The “max” value in the POST does NOT have to be explicitly adhered to by the TSSRegistry in the response -- the TSS MUST NOT send more events than the max value but it MAY send less events -- even 0 -- so long as the “remaining” field is accurate regarding the remaining event queue size. Responding with 0 events (yet a remaining field that is greater than 0) could occur just before a TSSRegistry maintenance window depending upon implementation characteristics. In either case, the TFT Router must be prepared for this possibility.