What’s the difference between the REST API and Web HMI?

REST API

The OAS Platform REST API, like all APIs is a programmatic interface. It allows developers to read and write real time Tag data, read real time and historical Alarms and Trends, and even create or update Tag configurations. Because it utilizes JSON data over HTTP(s), it can be used by any virtually any development platform or language. It is also a perfect alternative to the .NET Data Connector for applications not running .NET code. Developers need to handle client to server communication to the API within their code. This includes web technologies such as Javascript, but if browser visualization is required, Web HMI may be the preferred product to utilize.

REST API Language Support

  • Any language that can support sending JSON over HTTP/S (.NET, PHP, Python, JS, NodeJS, Java, and more)
  • Fully documented and interactive API found here

Typical Applications

  • Automated solutions without the need for a user interface or data visualization
  • Programmatic configuration of the OAS Platform when using the .NET Data Connector is not possible (e.g. your platform is not .NET)
  • Native mobile applications

Skills Required

  • Knowledge of HTTP processes and methods
  • Familiarity with JSON object structures

Learn more about the OAS REST API >>

Web HMI

The Web HMI product is specifically geared towards web applications that need to visualize real time and historical data. It consists of a set of Javascript libraries intended to be included in your web pages which handle server communication and screen updates. While the Web HMI product does include programmatic methods for reading and writing Tag data, development is strictly done within HTML and intended to be run in a browser.

Web HMI Language and Platform Support

  • Any web application platform – built on standards (HTML, CSS, Javascript)
  • Any web development platform
  • Purely a Javascript solution for browser-to-OAS communications

Typical Applications

  • Real time and historical data visualization
  • System management and control user interfaces
  • Browser-based desktop and mobile applications

Skills Required

  • Web application development skills
  • Familiarity with JSON object structures
  • Javascript skills for direct access to the Web HMI script library functions

Learn more about OAS Web HMI >>

One Click OPC UA

Tags can be automatically set up using the One Click OPC UA feature, which browses OPC UA servers automatically and creates tags based on the nodes defined in the OPC UA server. You can then delete tags from the configuration that are unnecessary.

Note: You will need to be running Open Automation Software Version 12.0.0.9 or greater to support the One Click OPC UA feature. You can download the latest version from our Open Automation Software Download page.

Step 1 – Configure OPC UA Driver

NOTE: If you have already defined a driver as described in the Getting Started – OPC UA Server guide you can proceed to Step 2 – Configure OPC UA Tags.

OAS

Start Configure OAS application from the program group Open Automation Software.

Select Configure-Drivers.

Configure Drivers

NOTE: To configure remote OAS Engines enter the IP Address or node name in the Network Node field and click on Select.

Network Node

Enter a meaningful Driver Interface Name that you will refer to this physical connection when defining Tags with an OPCUA Data Source.

OPC UA Driver Name

Set the Driver type to OPC UA.

OPC UA Driver

Define the Server Url property to the endpoint of the OPC UA server to connect to.

Server Url

Use the BROWSE button of the Security Profile to select one of the security profiles. Use None:None:Binary for the fastest interface.

OPC UA Security Profile
OPC UA Security Profiles

If the server requires user authentication enable the property User Security to define the Username and Password.

OPC UA User Security

NOTE: The certificate path is C:\ProgramData\OpenAutomationSoftware\pki on Windows and /ConfigFiles/pki/ on Linux. You may need to move the server’s certificate from the rejected\certs folder to the trusted\certs folder.

OPC UA Certificates

Select the Add Driver button in the upper left of the window to add the Driver Interface as an available selection when defining Tags in the next step.

Add Driver

Step 2 – Configure OPC UA Tags

Select Configure-Tags.

Menu Configure Tags

Select Add Group to add a group to place tags in.

Add Tag Group

Select the Group 01 group, then click the One Click Import button on the top toolbar.

One Click Import

Select the OPC UA Driver Interface defined in Step 1 if there are multiple drivers defined.

One Click OPC UA Driver

Select the IMPORT OPC UA ITEMS button.

Browse and select the parent folder containing all nodes this parent folder and all sub folders to automatically add.

One Click OPC UA Browse

Select to enable the options to Get Data Type from OPC UA Server and optionally the Descriptions.

Select the green Add Tags button in the lower left to all all nodes in this selected folder and all of its sub folders.

OPC UA Tags List

Optionally delete Tags and Groups you do not want to be included in the configuration that have been imported.
Select the Save button on the toolbar at the top.

Step 3 – Save OPC UA Tags and Drivers

Select the Save button on the toolbar at the top.

Load and Save

Enter a file name to be saved in C:\ProgramData\OpenAutomationSoftware\ConfigFiles directory on Windows or ConfigFiles subdirectory on Linux.

When prompted to set the file as the default configuration to load on startup select Yes.

Set Default Tag File

NOTE: The tags and and drivers are both saved into one file.

The tags defined are now ready for use in all OAS features like Data Logging, Data Route, and Open UIEngine.

Getting Started OPC DA

Open Automation Software Tags can be defined to connect to Classic OPC Data Access 2.xx and 3.0 Servers with the built in OPC Interface.

View the following video to see how to connect to a classic OPC DA server.

The following steps can be used to setup communications with Classic Data Access OPC Servers.

Step 1 – Configure OPC DA Tags

OAS

Start Configure OAS application from the program group Open Automation Software.

Select Configure-Tags.

Menu Configure Tags

NOTE: To configure remote OAS Engines enter the IP Address or node name in the Network Node field and click on Select.

Network Node

Select Add Group to add a group to place tags in.

Add Group
Add Tag Group

NOTE: You can add organizational Groups as many levels deep as you prefer and add tags to groups.  To do this first add a Group to the root level, then right click on the Group in the right window to add additional Groups or Tags.

Tag Group Options

Select Add Tag to add a tag to the group selected.

Add Tag
Add Tag to Group

Change the Data Source Tag property to OPC.

OPC Data Source

Use the Browse button to the right of the OPC Item to browse OPC Servers for the desired OPC Item.

Getting Started OPC Item

Select Local, the desired OPC Server, branch within the OPC Server, and OPC Item and click OK.
Getting Started OPC Browse

Note: If you wish to browse remote OPC servers via IP address see Networking OPC Data.

Specify the desired OPC Update Rate for the Tag.

Getting Started OPC Update Rate

To disable communications to the device you can use Enable by Tag to control when communications is active. Leave this property disabled to establish communications at all times.

Enable by Tag

The Device Read property can be used to disable continuous polling and request data on event from the transition from false to true of a value of a Boolean tag. Leave this property disabled to establish communications at all times.

Device Read

Select Apply Changes in the lower right to activate the communications for the OPC Item.

Apply Changes

The value from OPC Server for the OPC Item selected will appear in the current Value field.

Good Quality

NOTE: If the data quality is Bad Quality view the article Troubleshooting OPC Communications.

Step 2 – Define Multiple OPC Tags

To define multiple tags use one of the following optional methods.

  • Use One Click OPC to automatically create tags from all OPC Items from a selected OPC Server or branch within an OPC Server. Then selectively delete the groups and tags that are not required.
  • Use CSV Export and CSV Import on the toolbar together with Microsoft Excel to add or modify tags.
  • Programmatically define Tags using the free to use OASConfig component with the SetTagProperties method.
  • Programmatically define Tags with the OAS REST API.

Optionally define a secondary failover OPC Server if the primary OPC Servers fails under Configure-Options-OPC.

Step 3 – Save OPC DA Tags

Select the Save button on the toolbar at the top.

Load and Save

Enter a file name to be saved in C:\ProgramData\OpenAutomationSoftware\ConfigFiles directory on Windows or ConfigFiles subdirectory on Linux.

When prompted to set the file as the default configuration to load on startup select Yes.

Set Default Tag File

The tags defined are now ready for use in all OAS features like Data Logging, Data Route, and Open UIEngine.

Can the REST API push data to another destination?

REST APIs by their very nature are HTTP services. This means that they are based on a request/response model. They are not event-driven and not capable of pushing data to a destination. You can poll against the REST API for updated values, but the data is only as current as the polling rate. So if the polling rate is longer than the refresh rate on the server value, you may miss updates.

If you would like to move data based on events, you must write your own solutions using one of our other developer tools, such as the .NET Data Connector or the Universal Driver Interface.

Is the REST API secure?

YES! There are two levels of security when using the REST API. The first is the authentication required for all operations. You first perform an authentication call using a credential configured within the OAS Server. Then, you can encrypt all communications over the wire by using an SSL certificate and restrict the REST API to using only SSL communications.

After authentication, how long can I use the token and clientid?

The security token and client id granted to the caller after authentication represent a REST API session. As long as the server remains active (not rebooted), and the credentials are continually used, the session will not expire. If there is no activity on the session after 30 minutes, the session will expire and a 401 Unauthorized response will be returned for all operations. This idle timeout can be configured on the server using the OAS Configuration app. Go to Configure > Options, select your OAS server (usually localhost when configuring the current machine) and then go to the Networking tab. Here you can set the REST API Session Timeout in minutes.

When would I use the REST API?

The OAS Platform allows for connectivity and integration with many systems and devices. It also exposes tools for direct data integration and automation using .NET for Windows developers, and libraries for integration with web technologies. If you are developing custom software that runs on other platforms that do not host the .NET Framework, and if you prefer to develop more robust applications with or without user interfaces, the REST API is a perfect solution. It exposes functions for reading and writing real time and historical data, as well as operations for customizing the OAS tag configurations themselves.