# 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.

#### <span class="mw-headline" id="bkmrk-api-authorization-0">API authorization</span>

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>
```

#### <span class="mw-headline" id="bkmrk-reading-datapoint-va-0">Reading datapoint value</span>

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"}]
```

#### <span class="mw-headline" id="bkmrk-writing-datapoint-va-0">Writing datapoint value</span>

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"}]
```