Skip to main content

Restful data api

Actiweb platform offers simple resful type HTTP API available. Using API needs administrator to create API key or username for reading operations to be used in API operations.

API authorization

API key is added to /opt/slc/data/users.xml file in this format this

<?xml version="1.0" encoding="UTF-8"?>
<users>
<robot>
   <id>apiuser</id>
      <key>ad60f70e6aa90b21ac5917c8f5cbcf4b</key>
   </robot>
</users>

Reading datapoint value

In this example, we are reading value of pv field value in datapoint ioPoints/huoneet/203/lampotila using API key ad60f70e6aa90b21ac5917c8f5cbcf4b to authentication.

example

/plc.php?get=ioPoints/huoneet/203/lampotila.pv&key=ad60f70e6aa90b21ac5917c8f5cbcf4b

response

[{"get":"47"},{"time":"1630062396"}]

Writing datapoint value

In this example, we are writing value 20.5 to pv field in datapoint ioPoints/huoneet/203/asetus using API key ad60f70e6aa90b21ac5917c8f5cbcf4b to authentication.

example

/plc.php?set=ioPoints/huoneet/203/asetus.pv&value=20.5&key=ad60f70e6aa90b21ac5917c8f5cbcf4b

response

[{"set":"1"},{"time":"1630062396"}]