X
tripwire
home help demo blog
general use, 2018.03.18
JSON interface

TRIPWIRE supports external access to your data, returning results in JSON format.

The calls are made using cURL and POST variables. Valid input parameters are:

parameter
Numeric ID. The parameters returned are NOT determined by Tripwire, but by the reporting unit. If you call a parameter on site S that is not being reported, you will get nothing back.

valid parameter IDs
1: carbon resistor 1 (ohms)
2: carbon resistor 2 (ohms)
3: carbon resistor 3 (ohms)
4: carbon resistor 4 (ohms)
5: self test status
6: ERDU status
7: helium level (%)
8: CCA temperature (C)
9: GPA temperature (C)
10: shim channel 1
11: shim channel 2
12: shim channel 3
13: shim channel 4
14: shim channel 5
15: magnet type
16: turret sensor status
17: magnet pressure status
18: helium level 2 (%)
19: helium status
20: EIS status
21: battery status
22: switch heater status
23: battery voltage (VDC)
24: pressure heater status
25: compressor status (on/off)
26: coldhead sensor 1 (K)
27: shield sensor 1 (K)
28: shield sensor 2 (K)
29: turret sensor 1 (K)
30: turret sensor 2 (K)
35: switch heater resistance (ohms)
36: quench heater 1 resistance (ohms)
37: quench heater 2 resistance (ohms)
38: magnet pressure (psia)
39: average power (W)
40: average power status
41: quench heater status
42: shield status
43: field status
44: coldhead status
45: bore temperature
46: 80K bore temperature
47: 80K link temperature
48: 20K bore temperature
49: 20K shield temperature
50: switch heater status 2
51: ERDU button 2 status
52: ERDU button 3 status
51: ERDU button 1
52: ERDU button 2
53: ERDU button 3
reportStart,
reportFinish
Epoch time or standard format ("2017-01-01 01:00"). If reportFinish is less than reportStart, it's ignored.
siteId
A valid 32-character ID. The userId will map to a set of accessible sites. This ID must be in that set. Access is defined in Tripwire setup for each group.
userId
A valid 32-character ID. The userId is defined in Tripwire.

Returned values are shown in the calls below. This table gives details on each one.

accountId
The company ID (main) or group ID (managed group this user has access to).
accountId
The company ID (main) or group ID (managed group this user has access to).
alertType
1: helium level below X%
2: compressor on/off
3: shield temperature above X degrees Kelvin
4: magnet pressure above X psia
5: CCA temperature above X degrees Celsius
6: battery voltage below X VDC
(For an explanation of X, see trigger below.)
alertTypesFound
There are six alert types. No site can set more than five of these, so the value here is 1-5, denoting the number of different alerts the site is reporting now.
companyName
The company name (main ID or name of managed group this user has access to).
count
How many value sets are being returned.
deviceId
The remote unit's unique ID (same as siteId in the input parameters).
frequency
How often are alerts reported to the user?
method
Are alerts reported by SMS (1), email (2), or both (3)?
online
Has the unit reported in the last 31 minutes?
parameter
The numeric parameter ID (assigned internal to Tripwire). See the list above.
parameterName
The actual parameter name (text, assigned internal to Tripwire). See the list above.
reportsFound
The number of reports located.
reportId
The unique serial number assigned each time an RDU reports to Tripwire.
snooze
Alerts are not reported until the snooze time is past.
reportTime
The time of this report.
siteName
The name isdefined in Tripwire for the site ID. This is changed in setup.
trigger
The threshold value set by the user's alert. (See "X" above in alertType.)
value
The reported value (usually, but NOT ALWAYS numeric).

Now that we've defined the parameters and returned values, here are the JSON calls. All calls assume use of cURL and POST variables.

Validate a user id

CALL
curl -F "user=[userId]" -F "login=TRUE" http://tripwire.simplexable.com/json.php
SUCCESS
{ "status": "valid" }
FAILURE
{ "status": "invalidUserId" }

Get latest reports for all sites

CALL
curl -F "user=[userId]" -F "current=true" http://tripwire.simplexable.com/json.php
SUCCESS
{ "device_id": "siteId", "siteName": "siteName", "accountId": "accountId", "companyName": "companyName", "online": "online", "last_reading": "reportTIme", "count": "count", "values": [ { "parameter": "parameter", "value": "value", "parameter_name": "parameterName" } ] }, ..., { "device_id": "siteId", "siteName": "siteName", "accountId": "accountId", "companyName": "companyName", "online": "online", "last_reading": "reportTIme", "count": "count", "values": [ { "parameter": "parameter", "value": "value", "parameter_name": "parameterName" } ] }
FAILURE
{ "status": "noSitesFound" }

Get all values for one site and one parameter

CALL
curl -F "user=[userId]" -F "site=[siteId]" -F "parameter=[parameterId]" http://tripwire.simplexable.com/json.php
OPTIONAL START/FINISH TIMES
curl -F "user=[userId]" -F "site=[siteId]" -F "parameter=[parameterId]" -F "start=[start]" -F "finish=[finish]" http://tripwire.simplexable.com/json.php
  • Start and finish can be Epoch values or standard times.
  • If start is set and no finish, returned is start time until now.
  • If finish is set and no start, returned is all records until finish.
  • If start and finish are set and finish is earlier than start, finish is ignored.
SUCCESS
{ "deviceId": "deviceId", "siteName": "siteName", "accountId": "accountId", "companyName": "companyName", "reportsFound": "reportsFound", "parameter": "parameter", "reports": [ { "reportId": "reportId", "reportTime": "reportTime", "value": "value" }, ..., {"reportId": "reportId", "reportTime": "reportTime", "value": "value"} ] }
FAILURE DUE TO INVALID SITE ID:
{ "status": "invalid site ID" }
No values found (bad parameter value?)
{ "status": "no reports found" }
FAILURE (invalid site ID)
{ "status": "invalid site ID" }
FAILURE (invalid parameter)
{ "status": "invalid parameter" }

Get all current alarms for a user

CALL
curl -F "user=[userId]" -F "alarms=true" http://tripwire.simplexable.com/json.php
SUCCESS, ALARMS FOUND
{ "status": "alarmsFound", "devices": [ { "deviceId": "deviceIs", "siteName": "siteName", "accountId": "accountId", "companyName": "companyName", "alertTypesFound": alertTypesFound, "alertsFound": [ { "alertType": alertType, "parameter": parameter, "value": "value", "trigger": "trigger", "frequency": frequency, "method": method, "snooze": "snooze" } ] } , ..., "deviceId": "deviceIs", "siteName": "siteName", "accountId": "accountId", "companyName": "companyName", "alertTypesFound": alertTypesFound, "alertsFound": [ { "alertType": alertType, "parameter": parameter, "value": "value", "trigger": "trigger", "frequency": frequency, "method": method, "snooze": "snooze" } ] } ] }
SUCCESS, NO ALARMS FOUND
{ "status": "noAlarmsFound" }
FAILURE
{ "status": "invalidUserId" }
© 2014-2018, simplexable, llc