ezeio2:apiref:subscribe

This is an old revision of the document!


Request a websocket data stream, and commands to manage the data stream

Description

Request ticket and meta data:

https://api.eze.io/v1/subscribe/ticket

The subscribe/ticket call requests a websocket ticket and returns metadata for the group and ezeio units that are in context of the given API credentials.

Subsequent calls using the subscribe command are used to manage the data stream.

Parameters

The subscribe/ticket call has no parameters

Example usage

Using the subscribe API requires the following steps:

1) Request a websocket ticket and relevant meta data:

https://api.eze.io/v1/subscribe/ticket

This will return a JSON object with metadata listing the systems that will be accessible through the websocket.

The ws property is the complete websocket URI. This URI is valid only for 10 seconds following the call to subscribe/ticket.

2) Use the ws URI to open a websocket connection. The websocket will automatically receive all updates to any system (ezeio) covered by the API call credentials given in the original call to subscribe/ticket.

The following update types will be sent over the websocket connection: LOGDATA - log interval data STATUS - 10 minute interval data. Always sent from all systems.

3) Call subscribe with

Return value

JSON formatted data from the subscribe/ticket call:

(below example has added whitespaces for readability)

{
	"reqtime": "2021-01-31T14:15:16Z",
	"ws": "wss:\/\/api.eze.io\/ws\/wstktXXXXXXXXXXXXXXXXXXXXXXX",
	"api": "https:\/\/api.eze.io\/v1\/subscribe\/wstktXXXXXXXXXXXXXXXXXXXXXXX\/",
	"account": {
		"id": "123",
		"name": "eze System",
		"description": "eze System - Testaccount"
	},
	"systems": [{
			"serial": "ABC-123",
			"name": "Demo unit",
			"note": "This is a demo unit in our lab",
			"lastseen": "2021-01-31T14:10:11Z",
			"fields": [{
				"fieldno": "1",
				"name": "Tank Level: Distance from top",
				"unit": "in",
				"decimals": "2",
				"assettag": "TANKLVL",
				"loginterval": "0"
			}, {
				"fieldno": "2",
				"name": "Output flow",
				"unit": "gal/min",
				"decimals": "1",
				"assettag": "",
				"loginterval": "60"
			}]
		},
		{
			"serial": "ABC-456",
			"name": "Other demo unit",
			"note": "This is also a demo unit in our lab",
			"lastseen": "2021-01-31T14:09:56Z",
			"fields": [{
				"fieldno": "2",
				"name": "Air temperature",
				"unit": "F",
				"decimals": "1",
				"assettag": "",
				"loginterval": "300"
			}, {
				"fieldno": "3",
				"name": "Relative humidity",
				"unit": "percent",
				"decimals": "0",
				"assettag": "",
				"loginterval": "0"
			}, {
				"fieldno": "4",
				"name": "Voltage",
				"unit": "V",
				"decimals": "1",
				"assettag": "V",
				"loginterval": "0"
			}]
		}
	],
	"status": "OK",
	"exec_time": 0.055
}
  • ezeio2/apiref/subscribe.1611693269.txt.gz
  • Last modified: 2021-01-26 20:34
  • by andreh