REST APIs expose data or operations in a system via HTTP calls. The OAS REST API is no different in this regard, so it is intended to be used by 3rd party clients and developer tools. If you would like to connect to another 3rd party REST API and integrate the data into OAS Tags, you can use either the .NET Data Connector, or the Universal Driver Interface to develop a custom solution.
FAQs – REST API
If there are errors executing a REST API call, you can check the OAS Configuration app, click on the triangle icon (should be flashing of there's an error) and you'll see system errors.
Locate the REST API and expand it out and you should see the failed calls. But it often won't give you the detailed HTTP request/response and just contain the failed URL that was attempted. It's a good way to see if people are hitting incorrect endpoints.
If you use Postman to execute REST API calls, you can see the proper URLs, headers, body contents, etc. for making proper calls.
If you ever get these response or codes, this is what they mean:
401: Unauthorized - you have not included the clientid and token fields in the request header, or the session has expired
500: Unknown server error - this may be something we need to investigate since the data was submitted properly but an error occurred on the server processing the request.
404: The object you're trying to GET or PUT (update) does not exist
If you see "Service Unavailable" that means the REST API did not start up properly.
If you see a message indicating the Endpoint does not exist, this means the URL is not correct for the call.
If there's something specific you're attempting and don't know what the issue is, you can always look at a successful call from Postman's console and it will expose everything in the request header/body and response header/body. You can compare it to your failing call to see what you might need, such as the correct Content-type. You can always let us know what call you're stuck on and we can investigate why it might not work for you.
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
Can you run the REST API over SSL?
Yes, the REST API as well as Web HMI can be run over SSL. You must first install an SSL Certificate on your server for the domain name(s) that you intend to use, for example “https://hmi.myserver.com:58725”. Once the certificate is installed properly on the server, check Use SSL and select the installed certificate from the dropdown menu. For detailed instructions, please see read: Configuring OAS Web Services. Purchasing and installing an SSL certificate is outside of the scope of the OAS product. For more information on Windows and Certificates, see the following article.
Getting Started – Universal Driver Interface
See the Universal Driver Interface section under Data Sources on how to create and deploy an OAS driver with your own property definitions using Visual Basic .NET or C# .NET.
Videos – REST API
Getting started: OAS REST API and native iOS
Step 1
To read and write data between a native iOS app and OAS, you can use the OAS REST API. As a first step, register the HTTP listener with the OAS Service Control Manager under the section labeled “HTML HMI Registration”.
Define the exclusive Node Name and Port Number that is to be supported. The Node Name should be the registered domain name, IP address, or network node name that all clients will connect to from their browsers. If you are unsure of which node name to use, localhost will work in most cases.
NOTE: Before clicking “Register”, be sure to stop all services. If services are running, the Service Control app will prompt you to stop them.
Step 2
Start up all services, and be sure to include the Framework 4.5 Service as this houses the listener specific to the REST API.
Step 3
Test your API Service from your iOS device.
You will now ensure that your iPhone or iPad can communicate with OAS via the REST API. In this example, the OAS host is located at 192.168.0.101 on the local network, but you will have to replace this with the OAS host node on your network. The base URL you will use to connect to the REST API is http://{{node}}:{{port}}/OASREST/v2. Each operation performed against the REST API will use the specific operation name prepended with the base {{url}}. The first operation to complete is authentication. All sessions with the REST API must be authenticated. You can adjust the {{url}} in the following snippet and test authentication. In Xcode, create a new single-view iOS application, and choose Swift as the language. Add the following code to MainViewController.swift:
Authenticate Session (Swift):
import requests import json ### base url is http://{{node}}:{{port}}/OASREST/v2/ url = 'http://192.168.0.101:58725/OASREST/v2' # {{url}} op = '/authenticate' # {{operation}} data = '''{"username":"", "password":""}''' headers = {'Content-Type':'application/json'} ### Authentication is completed via a POST request response = requests.request("POST", url+op, data=data, headers=headers) print(response.text) ### Upon success, store your clientid and token for the remainder of the session json_data = json.loads(response.text) clientid = json_data["data"]["clientid"] token = json_data["data"]["token"]
If this code is executed without error, the response will include a clientid and token. These will be included in the header for all other operations.
{ "status":"OK", "data":{"clientid":"531041fa-e601-49d7-a02a-cf13f12eae28", "token":"919a303c-4537-4658-b4bf-242fc44e6493"}, "messages":["Default credential provided"] }
Here are some Python examples of basic HTTP requests you might wish to make via the REST API after having completed authentication. For additional information, see our REST API documentation.
Create a Tag (Python 3):
### code continues from above ### Create a Tag headers.update({"clientid":clientid}) headers.update({"token":token}) operation = '/tags' data = ''' { "path":"SomeDummyTag", "parameters": { "Value": { "DataType":"Double", "ParameterSource":"Value", "Value":"262.262" } } } ''' response = requests.request('POST', url+operation, data=data, headers=headers) print(response.text)
Successful tag creation results in the following response from the OAS server:
{"status":"OK","messages":["CREATE COMPLETE"]}
Read a Tag (Python 3):
Reading a tag is accomplished with a GET request, using a simple query including the path to the Tag.
### Read a Tag ### operation = '/tags' querystring= {'path':'SomeDummyTag'} response = requests.request('GET', url+operation, params=querystring, headers=headers) print(response.text)
A possible response from the OAS server:
[{"path":"SomeDummyTag","value":"262.262","quality":true,"type":"Float","timestamp":1521742596474}]
Update a Tag (Python 3):
Updating a tag is accomplished with a PUT request, using a payload including the path to the Tag, and the parameter(s) to be updated.
### Update a tag ### operation = '/tags' data = ''' { "path":"SomeDummyTag", "parameters": { "Value": { "Value":"54.59" } } } ''' response = requests.request('PUT', url+operation, data=data, headers=headers) print(response.text)
Update confirmation from the OAS server:
{"status":"OK","messages":["UPDATE COMPLETE"]}
Step 4
Write tag data from Raspberry Pi to OAS.
Now that you’ve established connectivity with the REST API, you can complete a Python script to write data from your device. Here is an example script which detects when a button is pushed, and forwards that data into OAS as a discrete tag value. An LED on the breadboard (see figure) indicates the current value, and the OAS server is polled at a frequency of 1 Hz to reflect the current state.
import RPi.GPIO as GPIO import time import requests import json ### Define a function to toggle the state of PiBit ### (You will likely prefer to inject all dependencies in production code) def toggleBit(state): data = '''{"path":"PiBit", "parameters":{ "Value":{ "Value":"'''+str(not state)+'''" }}}''' requests.request('PUT', url+operation, data=data, headers=headers) return not state ### read state of Boolean Tag def readBooleanTag(tagName): querystring = {'path':tagName} response = requests.request('GET', url+operation, params=querystring, headers=headers) json_response = json.loads(response.text) test = json_response[0]["value"] return test == "True" ### Write a callback function to execute on event detection def callback(input_pin): print("Input on pin",input_pin) current_state = GPIO.input(40) toggleBit(current_state) GPIO.output(40, not current_state) ### Authenticate session url = 'http://192.168.0.101:58725/OASREST/v2' operation = '/authenticate' data = ''' { "username":"", "password":"" } ''' headers = {"Content-Type":"application/json"} response = requests.request('POST', url+operation, data=data, headers=headers) ### Update headers with clientid and token json_data = json.loads(response.text) clientid = json_data["data"]["clientid"] token = json_data["data"]["token"] headers.update({"clientid":clientid}) headers.update({"token":token}) ### Create a tag to store a boolean operation = '/tags' data = ''' { "path":"PiBit", "parameters": { "Value": { "DataType":"Discrete", "ParameterSource":"Value", "Value":"False" } } } ''' response = requests.request('POST', url+operation, data=data, headers=headers) ### Setup Raspberry Pi IO board GPIO.setmode(GPIO.BOARD) GPIO.setup(36, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(40, GPIO.OUT) GPIO.output(40, False) ### Detect when input voltage drops, and poll server for current state GPIO.add_event_detect(36, GPIO.FALLING, callback=cb, bouncetime=100) try: while True: time.sleep(1) print(readBooleanTag("PiBit")) except KeyboardInterrupt: print("\nExiting\n") GPIO.cleanup()
For further help with the REST API, navigate to https://restapi.openautomationsoftware.com to open the REST API online documentation.
Writing data from Raspberry Pi using OAS REST API
Step 1
To write data into OAS from a Raspberry Pi, you will use the OAS REST API. As a first step, register the HTTP listener with the OAS Service Control Manager under the section labeled “HTML HMI Registration”.
Define the exclusive Node Name and Port Number that is to be supported. The Node Name should be the registered domain name, IP address, or network node name that all clients will connect to from their browsers. If you are unsure of which node name to use, localhost will work in most cases.
NOTE: Before clicking “Register”, be sure to stop all services. If services are running, the Service Control app will prompt you to stop them.
Step 2
Start up all services, and be sure to include the Framework 4.5 Service as this houses the listener specific to the REST API.
Step 3
Test your API Service from your Raspberry Pi.
You will now ensure that the Raspberry Pi can communicate with OAS via the REST API. In this example, the OAS host is located at 192.168.0.101 on the local network, but you will have to replace this with the OAS host node on your network. The base URL you will use to connect to the REST API is http://{{node}}:{{port}}/OASREST/v2. Each operation performed against the REST API will use the specific operation name prepended with the base {{url}}. The first operation to complete is authentication. All sessions with the REST API must be authenticated. You can adjust the {{url}} in the following snippet and test authentication.
Authenticate Session (Python 3):
import requests import json ### base url is http://{{node}}:{{port}}/OASREST/v2/ url = 'http://192.168.0.101:58725/OASREST/v2' # {{url}} op = '/authenticate' # {{operation}} data = '''{"username":"", "password":""}''' headers = {'Content-Type':'application/json'} ### Authentication is completed via a POST request response = requests.request("POST", url+op, data=data, headers=headers) print(response.text) ### Upon success, store your clientid and token for the remainder of the session json_data = json.loads(response.text) clientid = json_data["data"]["clientid"] token = json_data["data"]["token"]
If this code is executed without error, the response will include a clientid and token. These will be included in the header for all other operations.
{ "status":"OK", "data":{"clientid":"531041fa-e601-49d7-a02a-cf13f12eae28", "token":"919a303c-4537-4658-b4bf-242fc44e6493"}, "messages":["Default credential provided"] }
Here are some Python examples of basic HTTP requests you might wish to make via the REST API after having completed authentication. For additional information, see our REST API documentation.
Create a Tag (Python 3):
### code continues from above ### Create a Tag headers.update({"clientid":clientid}) headers.update({"token":token}) operation = '/tags' data = ''' { "path":"SomeDummyTag", "parameters": { "Value": { "DataType":"Double", "ParameterSource":"Value", "Value":"262.262" } } } ''' response = requests.request('POST', url+operation, data=data, headers=headers) print(response.text)
Successful tag creation results in the following response from the OAS server:
{"status":"OK","messages":["CREATE COMPLETE"]}
Read a Tag (Python 3):
Reading a tag is accomplished with a GET request, using a simple query including the path to the Tag.
### Read a Tag ### operation = '/tags' querystring= {'path':'SomeDummyTag'} response = requests.request('GET', url+operation, params=querystring, headers=headers) print(response.text)
A possible response from the OAS server:
[{"path":"SomeDummyTag","value":"262.262","quality":true,"type":"Float","timestamp":1521742596474}]
Update a Tag (Python 3):
Updating a tag is accomplished with a PUT request, using a payload including the path to the Tag, and the parameter(s) to be updated.
### Update a tag ### operation = '/tags' data = ''' { "path":"SomeDummyTag", "parameters": { "Value": { "Value":"54.59" } } } ''' response = requests.request('PUT', url+operation, data=data, headers=headers) print(response.text)
Update confirmation from the OAS server:
{"status":"OK","messages":["UPDATE COMPLETE"]}
Step 4
Write tag data from Raspberry Pi to OAS.
Now that you’ve established connectivity with the REST API, you can complete a Python script to write data from your device. Here is an example script which detects when a button is pushed, and forwards that data into OAS as a discrete tag value. An LED on the breadboard indicates the current value, and the OAS server is polled at a frequency of 1 Hz to reflect the current state.
import RPi.GPIO as GPIO import time import requests import json ### Define a function to toggle the state of PiBit ### (You will likely prefer to inject all dependencies in production code) def toggleBit(state): data = '''{"path":"PiBit", "parameters":{ "Value":{ "Value":"'''+str(not state)+'''" }}}''' requests.request('PUT', url+operation, data=data, headers=headers) return not state ### read state of Boolean Tag def readBooleanTag(tagName): querystring = {'path':tagName} response = requests.request('GET', url+operation, params=querystring, headers=headers) json_response = json.loads(response.text) test = json_response[0]["value"] return test == "True" ### Write a callback function to execute on event detection def callback(input_pin): print("Input on pin",input_pin) current_state = GPIO.input(40) toggleBit(current_state) GPIO.output(40, not current_state) ### Authenticate session url = 'http://192.168.0.101:58725/OASREST/v2' operation = '/authenticate' data = ''' { "username":"", "password":"" } ''' headers = {"Content-Type":"application/json"} response = requests.request('POST', url+operation, data=data, headers=headers) ### Update headers with clientid and token json_data = json.loads(response.text) clientid = json_data["data"]["clientid"] token = json_data["data"]["token"] headers.update({"clientid":clientid}) headers.update({"token":token}) ### Create a tag to store a boolean operation = '/tags' data = ''' { "path":"PiBit", "parameters": { "Value": { "DataType":"Discrete", "ParameterSource":"Value", "Value":"False" } } } ''' response = requests.request('POST', url+operation, data=data, headers=headers) ### Setup Raspberry Pi IO board GPIO.setmode(GPIO.BOARD) GPIO.setup(36, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(40, GPIO.OUT) GPIO.output(40, False) ### Detect when input voltage drops, and poll server for current state GPIO.add_event_detect(36, GPIO.FALLING, callback=callback, bouncetime=100) try: while True: time.sleep(1) print(readBooleanTag("PiBit")) except KeyboardInterrupt: print("\nExiting\n") GPIO.cleanup()
For further help with the REST API, navigate to https://restapi.openautomationsoftware.com to open the REST API online documentation.
Read Database Data
Use the OPCSystems.dll assembly to call GetDatabaseData to return a DataTable of values from a database table or view.
- The GetDatabaseData function returns a DataTable of values from the local or remote service by obtaining database values where the service is running.
- Returns blank DataTable if service is not reachable.
- DBProvider is the database provider type to use.
- DBServer is the database server to connect to. Not applicable for MS Access and Oracle.
- TableOrView is the table name or view name to query the data from.
- MSSQLWindowsAuthentication – when connecting with SQL Server use Windows Authentication. When false specify the DBUser and DBPassword for SQL user login.
- DBUser is the user name for security authentication. Not applicable if using SQL Server and MSSQLWindowsAuthentication is set to true.
- DBPassword is the password for security authentication. Not applicable if using SQL Server and MSSQLWindowsAuthentication is set to true.
- FieldNames is a string array containing the field names to query from the table for view.
- DataTypes is an array of field data types for the fields.
- UseDates will enable using the StartDate and EndDate.
- StartDate as the start date and time of history to retrieve.
- EndDate as the end date and time of history to retrieve.
- QueryString is the WHERE condition to append to the query. When blank it is not used.
- NetworkNode is the name of the network node of the OPC Systems Service to connect to. Leave blank for localhost connection.
- ErrorString will be set to Success when function is successful and an error message when in error.
- RemoteSCADAHostingName is the name of the Live Data Cloud OPC Systems Service to connect to.
VB
Private Sub ButtonGetDatabaseData_Click(sender As System.Object, e As System.EventArgs) Handles ButtonGetDatabaseData.Click Dim m_OPCSystemsComponent1 As New OPCSystems.OPCSystemsComponent Dim returnedDataTable As DataTable Dim localDBProvider As OPCSystems.OPCSystemsComponent.DBProviderTypes = OPCSystems.OPCSystemsComponent.DBProviderTypes.SQLServer Dim localDBServer As String = "OAS_SONY\SQLOAS" Dim database As String = "TestDB" Dim table As String = "TestCont" Dim useWindowsAuthentication As Boolean = True Dim user As String = "" Dim password As String = "" Dim FieldNames(3) As String FieldNames(0) = "Ramp_Value" FieldNames(1) = "Value01_Value" FieldNames(2) = "Value02_Value" FieldNames(3) = "Value03_Value" Dim FieldDataTypes(3) As OPCSystems.OPCSystemsComponent.FieldDataTypes FieldDataTypes(0) = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData FieldDataTypes(1) = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData FieldDataTypes(2) = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData FieldDataTypes(3) = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData Dim useStartAndEndDates As Boolean = True Dim dateTimeFieldName As String = "DateAndTime" Dim endDate As Date = Now Dim startDate As Date = endDate.AddYears(-1) Dim networkNode As String = "localhost" Dim errorString As String = "" returnedDataTable = m_OPCSystemsComponent1.GetDatabaseData(localDBProvider, localDBServer, database, table, useWindowsAuthentication, user, password, FieldNames, FieldDataTypes, useStartAndEndDates, dateTimeFieldName, startDate, endDate, "", networkNode, errorString) DataGridView1.DataSource = returnedDataTable End Sub
C#
private void ButtonGetDatabaseData_Click(object sender, System.EventArgs e) { OPCSystems.OPCSystemsComponent m_OPCSystemsComponent1 = new OPCSystems.OPCSystemsComponent(); DataTable returnedDataTable = null; OPCSystems.OPCSystemsComponent.DBProviderTypes localDBProvider = OPCSystems.OPCSystemsComponent.DBProviderTypes.SQLServer; string localDBServer = "OAS_SONY\\SQLOAS"; string database = "TestDB"; string table = "TestCont"; bool useWindowsAuthentication = true; string user = ""; string password = ""; string[] FieldNames = new string[4]; FieldNames[0] = "Ramp_Value"; FieldNames[1] = "Value01_Value"; FieldNames[2] = "Value02_Value"; FieldNames[3] = "Value03_Value"; OPCSystems.OPCSystemsComponent.FieldDataTypes[] FieldDataTypes = new OPCSystems.OPCSystemsComponent.FieldDataTypes[4]; FieldDataTypes[0] = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData; FieldDataTypes[1] = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData; FieldDataTypes[2] = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData; FieldDataTypes[3] = OPCSystems.OPCSystemsComponent.FieldDataTypes.DoubleFloatData; bool useStartAndEndDates = true; string dateTimeFieldName = "DateAndTime"; DateTime endDate = DateTime.Now; DateTime startDate = endDate.AddYears(-1); string networkNode = ""; string errorString = ""; returnedDataTable = m_OPCSystemsComponent1.GetDatabaseData(localDBProvider, localDBServer, database, table, useWindowsAuthentication, user, password, FieldNames, FieldDataTypes, useStartAndEndDates, dateTimeFieldName, startDate, endDate, "", networkNode, errorString); DataGridView1.DataSource = returnedDataTable; }
How can I programmatically browse OPC Servers?
Yes, using the free to use OPCSystems component. Refer to the WinForm Example Code under the program group Open Automation Software-Example in the Form FormConfigureOPC.
This example is also listed in this help file in Programmatic Interface – .NET Programmatic Configuration – Programmatic Access OPC Browsing.
Getting Started – REST API
The following guide demonstrates how to connect to the OAS REST API.
To see how to use the OAS Platform with an external REST API view the Moving Data to an External REST API Use Case.
- 00:00 – Introduction
- 00:12 – What is REST API?
- 00:48 – What CRUD stands for?
- 00:52 – Database Terms for CRUD
- 01:00 – HTTP Parallel Methods
- 01:11 – Examples – Resources URLs
- 03:29 – What JSON stands for?
- 04:01 – Example – Difference between XML – JSON
- 04:22 – When to use OAS REST API
- 05:21 – REST Client Example Code
- 06:03 – Before using REST API
- 08:55 – REST Client Sample Code
- 10:03 – JavaScript
- 11:10 – Set HTTP Status
- 11:35 – Add Virtual Directory
- 12:12 – Sample Rest API Client
- 13:14 – Create a Tag List to Monitor
- 15:30 – Visual Studio
- 17:45 – Postman Application
- 21:08 – More Information
Step 1
To use the OAS REST API you must make sure that the OAS HTTP service is listening on the correct port. This is done within the OAS Configuration application.
Open the OAS Configuration application and select Configure > Options, then select the network node (localhost if working on the local machine) and click Select.
Under the Networking tab, locate the field for REST API/WebHMI Port Number. The default is 58725 but can be changed. If you are accessing the server from a remote client, you will also need to make sure your machine and/or company firewalls allow TCP traffic on the selected port.
Using SSL with REST API is fully supported.
Read more about Configuring OAS to use SSL for Web and REST API products.

NOTE: Making any changes to the port numbers in this section of the configuration app will temporarily restart server processes and may cause a brief interruption in data processing.
Step 2
Install Postman
Navigate to https://restapi.openautomationsoftware.com to open the REST API online documentation.

This documentation illustrates all of the operations available to any REST API client and can be tested using the Postman application client. In the upper right corner of the documentation, you will see a button to Run in Postman, which will install the API documentation into the Postman client for direct execution against any OAS server. Additionally, the documentation can be configured to display code samples in multiple languages including cURL, jQuery, and NodeJS. Feel free to browse the documentation at any time and to refer back to it while developing your applications.

Clicking Run in Postman will pop up a dialog box to import the REST API into an existing installation of Postman, or you can choose to install the app for the first time. Postman is available for Windows and Mac desktops as well as in a Chrome extension.

Step 3
Test your API installation
Once installed and the API has been downloaded into the app, you will see the following interface, with all operations on the left, organized identically to the online documentation:

The first operation to execute is the Authenticate call, which will generate a REST API session and returns a clientid and token to be used in all subsequent calls to the OAS server.
In the list of operations, expand and select Authenticate and you will see the following on the right side of the app:

This shows that the Authenticate operation is executed as an HTTP POST against the /authenticate URL appended to the base {{url}}. This base URL is defined in your Environment here. Select Manage Environments to add new fields:

Add your server to the Environments list
Click ADD to create a new Environment which will hold environment variables:

Add a name for your environment, then add a key of url with a value of http://localhost:58725/OASREST/v2 and click ADD to create the new environment. You can also use your OAS server’s IP address instead of localhost, if you are connecting to it from a remote workstation.
Next, return to execute the the Authenticate operation.

Now under the Environments dropdown, select your new Environment. You should see the {{url}} turn orange, indicating that the environment variable is being used.

You can now click SEND to execute the post against your server. If successful, you should see a response body similar to the one below, containing the clientid and token fields.

You can then use these fields in the header of all other operations using the Postman app to test your server.
Step 4
Accessing Tag Values
Once authenticated, you are now able to use the clientid and token in HTTP headers to make calls to configure Tags, access real time and historical Tag data, and even real time and historical Alarm and Trend data. When referencing Tags in any call, you it is assumed that you are accessing them on the OAS server being called in the REST API. However, you can also access remote Tags on any OAS server networked with the target server. Read more about the proper syntax for accessing Tags and Tag Variables.
Remote Access
OAS servers can communicate with each other and pass along tag data. This allows for distributed network load as well as placing OAS servers behind firewalls so they cannot be accessed directly. This allows you to securely issue REST API calls against one server and read/write data within a remote OAS server that cannot be reached directly from the REST API client. This same concept applies whether you are calling the OAS REST API or using the .NET Data Connector for programmatic Tag access and configuration.
- Main OAS Engine : the server handling the REST API calls
- Remote OAS Engine : the server housing the tag data or configuration you would like to access

REST API URL
Set the url to OAS Engine that the REST API will be hosted from. This is the URL to the Main OAS Engine whether you are accessing tag data on the Main OAS Engine or on a Remote OAS Engine.
Localhost URL : will only work when accessing the Main OAS Engine on the same machine as the client.
http://localhost:58725/OASREST/v2
Explicit URL : use the IP Address or domain name of the Main OAS Engine, allowing you to access it from a remote client. This will also work on the same machine and is the best option for code flexibility.
http://192.168.0.1:58725/OASREST/v2
Tag Access
Main OAS Engine Tag – accessing tag data on the Main OAS Engine only requires referencing the tag path.
{ "tags": [ {"path":"TagName.Value"} ] }
Remote OAS Engine Tag – To monitor real time data from Remote OAS Engines reference the tag path in the form \\<Remote OAS address>\<Tag Path>
. Note in the example below that backslash characters are escaped within strings, changing \ to \\ and \\ to \\\\.
Basic Networking – Static IP or domain name
{ "tags": [ {"path":"\\\\192.168.0.2\\TagName.Value"}, {"path":"\\\\192.168.0.3\\TagName.Value"}, {"path":"\\\\myserver.com\\TagName.Value"} ] }
Live Data Cloud Networking – Dynamic IP
Once you have registered named Live Data Cloud nodes on an OAS server, you can reference them in the form RemoteSCADAHosting.<Node Name>.<Tag Path>
.
{ "tags": [ {"path":"RemoteSCADAHosting.LiveDataCloudNode01.TagName.Value"}, {"path":"RemoteSCADAHosting.LiveDataCloudNode02.TagName.Value"}, {"path":"RemoteSCADAHosting.LiveDataCloudNode03.TagName.Value"} ] }
Remote Configuration Calls
To execute REST API Tag Configuration calls against Remote OAS Engines, you can use the networknode parameter to reference a static IP or domain name, or the ldc parameter to reference a Live Data Cloud node name. The example below demonstrates calls to the CSV Tag configuration calls using each of these methods.
Basic Networking – Static IP or domain name
http://192.168.0.1:58725/OASREST/v2/csvtags?columns=Tag,Value - Data Type,Value - Value,Last Column&networknode=192.168.0.2
Live Data Cloud Networking – Dynamic IP
http://192.168.0.1:58725/OASREST/v2/csvtags?columns=Tag,Value - Data Type,Value - Value,Last Column&ldc=LiveDataCloudNode01
Remote Security
Because your authentication call is always against the Main OAS Engine, that same credential will be passed to any networked OAS Engine when referencing remote Tags. So it is critical to make sure the same credential (username/password) exists on all networked OAS Engines and has been granted the appropriate access level for the command being executed.