The OPC Rest API application is developed in Python and used in conjunction with OpenOPC to connect and report back lists, tags and properties from OPC Servers. The user sends a HTTP API call to the configured server with command parameters and returns a JSON result. It is a http link through OpenOPC to the OPC Server.
Documentation for installing OpenOPC here
Functions
List
This function is a mirror to OpenOPC’s list function with non-recursive options set. You can parse in either ‘*’ or the branch that you would like to list. Request example:
http://172.20.60.43:8003/method=list¶m=* http://172.20.60.43:8003/method=list¶m=Root.*
Typical Response:
[["Root.Boilers.#1 Boiler.FI8110.PV.Value", "Leaf"], ["Root.Boilers.#1 Boiler.PI8110.PV.Value", "Leaf"], ["Root.Boilers.#1 Boiler.TI8110.PV.Value", "Leaf"]]
List Recursive
This function is a mirror to the OpenOPC’s list function with recursive options set. It returns a flat list of all leaves from the parameters set. You can parse in either ‘*’ or the branch you would like to list. Request example:
http://172.20.60.43:8003/method=listrecursive¶m=* or http://172.20.60.43:8003/method=listrecursive¶m=Root.*
List Tree
This function is a custom list function that was designed to simulate branching when the database has been set up as a flat directory where leaves are categorized by points. It returns the next level of “branch” based on the parameters set. You can parse in either ‘*’ or the branch you would like the next level of. Request example:
http://172.20.60.43:8003/method=listtree¶m=* or http://172.20.60.43:8003/method=listtree¶m=Root.*
Typical response:
[["Boilers", "Branch", null], ["Cane Prep & Milling", "Branch", null], ["Cane Receivals", "Branch", null], ["Evaporation", "Branch", null], ["Injection Water", "Branch", null], ["Juice Treatment", "Branch", null], ["Pan Stage", "Branch", null], ["Powerhouse", "Branch", null], ["Sugar & Molasses Handling", "Branch", null], ["Wireless Data", "Branch", null]]
Read
This function mimics OpenOPC’s read function. Parsing in a branch or leaf and it will return a tuple of values. Request example:
http://172.20.60.43:8003/method=read¶m=Root.Int4
Properties
This mimics the OpenOPC’s properties function. Parsing in a leaf name or multiple leaves will return the result that you would expect when calling it via OpenOPC, unformatted. For example:
http://172.20.60.43:8003/method=properties¶m=Root.Powerhouse.Common%20Items.Auto%20Export%20Functions.PY7700.SW.Value or http://172.20.60.43:8003/method=properties¶m=Root.Powerhouse.Common%20Items.Auto%20Export%20Functions.PY7700.SW.Value,Root.Powerhouse.Common Items.EI7703.PV.Value
JSON Properties
This is a custom function that takes the results of the OpenOPC’s properties function and formats it to a more common array structure. Parsing in a leaf name or multiple leaves will return an array for each leaf’s properties. For example:
http://172.20.60.43:8003/method=jsonproperties¶m=Root.Powerhouse.Common%20Items.Auto%20Export%20Functions.PY7700.SW.Value or http://172.20.60.43:8003/method=jsonproperties¶m=Root.Powerhouse.Common%20Items.Auto%20Export%20Functions.PY7700.SW.Value,Root.Powerhouse.Common Items.EI7703.PV.Value
Search
This is a search utility that goes through OpenOPC’s list function attempting to locate branches and leaves with the parsed params. For example:
http://172.20.60.43:8003/method=search¶m=Common