We provide an API via Web-Service that can read and write tag values. To access the tags, a login is required for solution users. You can directly access this API through HTTP (REST API) connecting with a runtime system. 

This page presents information about how to use the WebAccess REST API.

On this page:


Contract Methods Using Rest API

SetServer

Defines the Server for following requests. 

Method: GET

URL Example:  http://localhost:3101/rtServices/api/SetServer

Request
Request/Headers
     . Content-Type: application/json
   . Request/Body
     . { "ModuleName": "Test", "UserName": "guest", "Password": "" }


Response
Response/Headers
     . Access-Control-Allow-Origin: *
     . Access-Control-Allow-Headers: Content-Type, Content-Length, Authorization
     . Access-Control-Expose-Headers: Content-Type, Content-Length, Authorization
     . Access-Control-Allow-Methods: *
     . Content-Length: 0
     . Content-Type: application/octet-stream
     . Access-Control-Max-Age: 1728000
     . Authorization: Bearer c30730a4-e2ee-4595-9131-d64769c5afbe
     . Date: Tue, 28 Nov 2023 13:47:35 GMT
     . Server: TServer WebServer
   . Response/Headers
     . Nothing

ReadObject

Reads value from specified object:

Method: GET

URL Example: http://localhost:3101/rtServices/api/SyncObjects/ReadObject

Request
Request/Headers
     . Content-Type: application/json
     . Authorization: Bearer c30730a4-e2ee-4595-9131-d64769c5afbe
     . content-length: 25
   . Ex: .../api/SyncObjects/ReadObject?ObjectName=Tag1


Response
Response/Headers
     . Content-Length: 89
     . Content-Type: application/json
     . Content-Encoding: utf8
     . Date: Tue, 28 Nov 2023 13:56:03 GMT
     . Server: TServer WebServer
   . Response/Body
     . { "ObjectName":"Tag1","Value":11,"Quality":192,"UtcTimeStamp":"11/28/2023 1:49:28.000 PM" }

ReadObjects

Reads value from multiple specified objects

Method: GET

URL Example: http://localhost:3101/rtServices/api/SyncObjects/ReadObjects

Request
Request/Headers
     . Content-Type: application/json
     . Authorization: Bearer c30730a4-e2ee-4595-9131-d64769c5afbe
     . content-length: 25
   . Request/Body
     . { "ObjectNames": [ "Tag1", "Server.Now" ] }


Response
Response/Headers
     . Content-Length: 89
     . Content-Type: application/json
     . Content-Encoding: utf8
     . Date: Tue, 28 Nov 2023 13:56:03 GMT
     . Server: TServer WebServer
   . Response/Body
     . [ {"ObjectName":"Tag1","Value":11,"Quality":192,"UtcTimeStamp":"11/28/2023 10:47:50.581 AM"},{"ObjectName":"Server.Now","Value":"11/28/2023 1:48:26.003 PM"} ]

WriteObject

Write value to a specified object

Method: POST

URL Example:http://localhost:3101/rtServices/api/SyncObjects/WriteObject

Request
Request/Headers
     . Content-Type: application/json
     . Authorization: Bearer c30730a4-e2ee-4595-9131-d64769c5afbe
     . content-length: 25
   . Request/Body
     . { "ObjectName" : "Tag1", "Value" : 11, "Quality": 192, "UtcTimestamp": "11/28/2023 1:49:28.000 PM" }


Response
Response/Headers
     . Content-Length: 89
     . Content-Type: application/json
     . Content-Encoding: utf8
     . Date: Tue, 28 Nov 2023 13:56:03 GMT
     . Server: TServer WebServer
   . Response/Body
     . true

WriteObjects

Write value to specified objects

Method: POST

URL Example:http://localhost:3101/rtServices/api/SyncObjects/WriteObjects

Request
Request/Headers
     . Content-Type: application/json
     . Authorization: Bearer c30730a4-e2ee-4595-9131-d64769c5afbe
     . content-length: 25
   . Request/Body
     . { "ObjectList": [ {"ObjectName": "Tag1", "Value": 11 }, { "ObjectName": "Tag2", "Value": 2, "Quality": 192, "UtcTimeStamp": "11/28/2023 10:18:22.260 AM" } ] }


Response
Response/Headers
. Content-Length: 89
. Content-Type: application/json
. Content-Encoding: utf8
. Date: Tue, 28 Nov 2023 13:56:03 GMT
. Server: TServer WebServer
. Response/Body
. [true,true]

In this section:

  • No labels