Web API Result to OPC UA Server

I need to make regular requests (every 30 seconds) to a Web API, take the resultant JSON, and store specific pieces of data into Tags for the HMI.
Additionally I must expose those tags to the OPC UA Server for external OPC UA Client devices to read and use in the control process.

What is the best way to accomplish this?

I have tested the following setup, and it works, but I would like to know if there is a better way:

  1. Create a device simulator in the gateway with repeat program disabled (To ensure no API values are overwritten)
    a. Add instructions with appropriate paths/data types as-needed. Value source assigned to the default of 0
  2. In the Designer, add Tags that are mapped to the OPC items created in step 1.
  3. Add a gateway event that runs on a timer and executes the following sample script:
    header = {
    “Authorization”: “[AUTH KEY]”
    response = system.net.httpGet(url = “https://www.myapi.com/api/url/here”, headerValues = header)
    data = system.util.jsonDecode(response)
    system.tag.writeBlocking(["[default]Sample/Tag1"], [data[“tag1_value”]])

Is this an appropriate approach in an enterprise level deployment?
Potentially a few thousand data points being requested, written to tags, and exposed via the device simulator?

Better would be to not use a simulator, just make a folder or UDT full of memory tags, and then enable the “Expose Tag Providers” feature on Ignition’s OPC UA server.

The only downside to this approach is that it exposes all tags to the client, so maybe it won’t work for you. Even when that’s disabled, though, all devices are exposed to connected clients.


I like your approach better than Kevin’s, because I despise the all-exposed model when allowing tag providers to show up in the OPC server.

If you need tighter access control, instead of the simulator, consider either my Modbus Server driver, or my Ethernet/IP driver. They can expose limited data to external users via Modbus TCP or Logix-style tag access instead of OPC/UA.

Thanks for the input guys! Appreciate the exposure option and the additional module approach

I will review the options with my team as this seems to be a “which tool is best” kind of question now.

If we do opt to go with the Simulator route for refined OPC control, do you foresee any scalability issues?

It’s probably okay, though I don’t know if the simulator has been used in that manner or tested with thousands of instructions.

Fair enough, I appreciate the input!