User manual
REST interface
4
3. REST interface
The gpio.ipCore is accessed by HTTP GET, PUT or POST commands. The URL used either
directly describes a Modbus resource (http://ipcore.local/gpio/...) or a key in the database
(http://ipcore.local/shared/...). Data is transmitted in JSON format.
3.1. Example 1: Access a card at the RS485 Modbus
Let's assume several gpio.net cards at the bus. Address 5 is a gpio.relay card.
Enquiries to the REST interface (GET) either provide a list of continuative suffixes or a
simple object containing the result of the enquiry:
http://ipcorelocal/gpio/RS485
→ [1, 3, 4, 5, 9]
http://ipcore.local/gpio/RS485/5
→ ["out","in","relay","counter"]
http://ipcore.local/gpio/RS485/5/in/A1
→ {"Value": 1}
3.2. Example 2: Access to the database
Queries (GET) about any keys will result in a tuple consisting of the key (string) and its
saved value (string):
http://ipcore.local/shared/myKey
→ {"key": "myKey", "value": "null"}
→ {"key": "myKey", "value": "data associated with myKey"}
The setting (PUT/POST) of keys is performed by writing a value to any (even if non-
existent) key. There, the data type of the value is always a string.
curl anyauth user user:password data "Test" ipcore.local/shared/newKey
curl anyauth user user:password data "123" ipcore.local/shared/new/test