JSON Output

Note

The Stream Connector is deprecated and we recommend using the MQTT connector for inter-task and inter-instance communications.

Live data via HTTP(S)

Output streams make live values available in JSON format. You can use the data in Microsoft Excel or your own software for specialized reporting or data processing. To access the data, the output stream must be configured for server mode, the local server must be configured (see remote service configuration) for access via HTTP or HTTPS and at least one task must be running sending data to the output stream.

To view live data in a browser, the server should not have access restrictions. If live data arrives on a computer that is not secure then either chain streams to forward data onto a system that is secure or configure IIS to restrict access to the local network only.

URL format

Data is accessible in the following form. Assuming that IIS is configured to serve stream data at “http://localhost:7272” then browsing to this URL should result in a plain text response echoing the Stream Web Server version, i.e. “UA Office Link Stream Web Server Version …”.

All further data is accessed via URL path “http://localhost:7272/api/v1/streams”. Streams themselves are not browsable and the latter URL will return a “Not found” result. The following table shows URL paths for browsable data. The prefix “http://localhost:7272/api/v1/streams” is omitted here, so that, for example, when a URL path is shown as “…/OutStream1” then the full URL is “http://localhost:7272/api/v1/streams/OutStream1”.

URL paths are case sensitive, for example, “OutStream1” is different from “outstream1”.

URL Path Response
…/OutStream1 Stream name and the stream’s task names (running tasks sending data to the output stream).
…/OutStream1/tasks List of task names of the output stream.
…/OutStream1/tasks/Task1 Task name and the task’s topics and tags.
…/OutStream1/tasks/Task1/topics Task topics, tags and current tag values.
…/OutStream1/tasks/Task1/topics/Topic1 Topic name and the topic’s tags and current tag values.
…/OutStream1/tasks/Task1/topics/Topic1/tags Topic tags and current tag values.
…/OutStream1/tasks/Task1/topics/Topic1/tags/Tag1 Tag name and current value.
…/OutStream1/tasks/Task1/topics/Topic1/tags/Tag1/value Tag value.
…/OutStream1/tasks/Task1/topics/Topic1/tags/Tag1/t Tag value timestamp.
…/OutStream1/tasks/Task1/topics/Topic1/tags/Tag1/s Tag value status code.

Tag values include a timestamp and a status code. The status code corresponds to the OPC UA definition of status codes with a zero status code being a ‘good’ status.

Examples

The following examples show URL paths and JSON output for an output stream “OutStream1” with one task “Task1” sending two topics “Signals1” and “Signals2” to the stream. “Signals1” contains three tags “Sine1”, “Sine2” and “Sine3” and “Signals2” contains three tags “Ramp1”, “Ramp2” and “Ramp3”.

http://localhost:7272/api/v1/streams/OutStream1

{
   "name": "OutStream1",
   "tasks": [
      "Task1"
   ]
}

http://localhost:7272/api/v1/streams/OutStream1/tasks

[
   "Task1"
]

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1

{
   "name": "Task1",
   "topics": [
      {
            "name": "Signals1",
            "tags": [
               "Sine1",
               "Sine2",
               "Sine3"
            ]
      },
      {
            "name": "Signals2",
            "tags": [
               "Ramp1",
               "Ramp2",
               "Ramp3"
            ]
      }
   ]
}

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1/topics

[
   {
      "name": "Signals1",
      "tags": [
            {
               "name": "Sine1",
               "value": 36.95518,
               "t": "2020-05-27T22:23:14.1020453Z",
               "s": 0
            },
            {
               "name": "Sine2",
               "value": -36.95518,
               "t": "2020-05-27T22:23:14.1020453Z",
               "s": 0
            },
            {
               "name": "Sine3",
               "value": 28.284271,
               "t": "2020-05-27T22:23:14.1020453Z",
               "s": 0
            }
      ]
   },
   {
      "name": "Signals2",
      "tags": [
            {
               "name": "Ramp1",
               "value": 55,
               "t": "2020-05-27T22:23:14.1020453Z",
               "s": 0
            },
            {
               "name": "Ramp2",
               "value": 190.25,
               "t": "2020-05-27T22:23:14.1020453Z",
               "s": 0
            },
            {
               "name": "Ramp3",
               "value": 53,
               "t": "2020-05-27T22:23:14.1020453Z",
               "s": 0
            }
      ]
   }
]

Tag value fields named “t” are timestamps and tag value fields named “s” are status codes.

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1/topics/Signals1

[
   {
      "name": "Signals1",
      "tags": [
            {
               "name": "Sine1",
               "value": 9.154424,
               "t": "2020-05-27T22:24:31.1054175Z",
               "s": 0
            },
            {
               "name": "Sine2",
               "value": -9.154424,
               "t": "2020-05-27T22:24:31.1054175Z",
               "s": 0
            },
            {
               "name": "Sine3",
               "value": 17.822916,
               "t": "2020-05-27T22:24:31.1054175Z",
               "s": 0
            }
      ]
   }
]

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1/topics/Signals1/tags

[
   {
      "name": "Sine1",
      "value": -30.416239,
      "t": "2020-05-27T22:25:03.0996451Z",
      "s": 0
   },
   {
      "name": "Sine2",
      "value": 30.416239,
      "t": "2020-05-27T22:25:03.0996451Z",
      "s": 0
   },
   {
      "name": "Sine3",
      "value": 39.507534,
      "t": "2020-05-27T22:25:02.5998983Z",
      "s": 0
   }
]

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1/topics/Signals1/tags/Sine1

{
   "name": "Sine1",
   "value": 39.876694,
   "t": "2020-05-27T22:26:35.0970722Z",
   "s": 0
}

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1/topics/Signals1/tags/Sine1/value

39.876694

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1/topics/Signals1/tags/Sine1/t

"2020-05-27T22:26:35.0970722Z"

http://localhost:7272/api/v1/streams/OutStream1/tasks/Task1/topics/Signals1/tags/Sine1/s

0