Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If basic authentication is used, the user name and password must be encoded in the basic authentication header field of the HTTP request. This must be done for each request.

JWT authentication

(warning) TBDJWT config options can be set in xio.TreeApi.cfg
A Bearer token can be retrieved via POST /security/createToken
Body:

Code Block
{
  "username": "--username--",
  "password": "--password--"
}

A new token can be retrieved by providing a valid token to GET /security/refresh

Request and response body

...

Note

Instead of backslash \ the normal slash / must be used as separator.

URL Parameters

Parameter

Description

Values

Mandatory

light

If activated, only the value of the item is returned. If deactivated, a set of predefined properties are returned.

true/false

No. Default: false

waitForChange

return request on item value change

true/false

No. Default: false

properties

Comma-separated list of item property ids to fetch

<property-id>,<property-id>,…

No. Default: empty

Example

Request:

Code Block
GET http://127.0.0.1:21012/NETx/VAR/Boolean/Item001?properties=1002,1003,1004

...

Code Block
http(s)://<ip or host>:<port>/read

URL parameters

Parameter

Description

Values

Mandatory

light

If activated, only the value of the item is returned. If deactivated, a set of predefined properties are returned.

true/false

No. Default: false

Request body

Code Block
["<item id1>", "<item id2", ...]

...

Code Block
[
    {
        "itemId": "NETx\\VAR\\Boolean\\Item001",
        "apiPath": "NETx/VAR/Boolean/Item001",
        "parentItemId": "NETx\\VAR\\Boolean",
        "name": "Item001",
        "description": "Variable 1 (Boolean)",
        "type": 21,
        "quality": "uncertain",
        "value": null,
        "lastChange": "2023-05-26T10:05:51.437Z",
        "accessRights": "readWrite",
        "source": ""
    },
    {
        "itemId": "NETx\\VAR\\Boolean\\Item002",
        "apiPath": "NETx/VAR/Boolean/Item002",
        "parentItemId": "NETx\\VAR\\Boolean",
        "name": "Item002",
        "description": "Variable 2 (Boolean)",
        "type": 21,
        "quality": "uncertain",
        "value": null,
        "lastChange": "1899-12-30T00:00:00Z",
        "accessRights": "readWrite",
        "source": ""
    }
]

Read tree recursively

Retrieve current tree state recursively

Code Block
$ curl -u "usr:passwd" -s http://localhost:21012/tree

URL parameters

Parameter

Description

Values

Mandatory

root

Base item branch (required, eg. NETx/VAR).

Yes.

properties

Comma-separated list of item property ids to fetch.

No. Default: ““

depth

Maximum recursion depth (0=unlimited).

No. Default: 0

Read partial tree recursively

Retrieve multiple tree parts recursively

Code Block
$ curl -u "usr:passwd" -s -X POST -H "Content-Type: application/json" -d '["NETx/VAR/String/Item001", "NETx/VAR/String/Item002"]' http://localhost:21012/tree

URL parameters

Parameter

Description

Values

Mandatory

properties

Comma-separated list of item property ids to fetch.

No. Default: ““

depth

Maximum recursion depth (0=unlimited).

No. Default: 0

Write Item value

In case the api permission for this item is write-only ('w'), the request returns with HTTP 204

...

Code Block
$ curl -u "usr:passwd" -s -X POST -H "Content-Type: application/json" -d '"NEW Value for 001"' <http://localhost:21012/NETx/VAR/String/Item001?light=true>

Listen for item value changes

Make sure to include the 'Authorization' header based on your chosen settings.

Code Block
ws://localhost:21012/live?items=NETx/VAR/String/Item001,NETx/VAR/String/Item002

URL parameters

Parameter

Description

Values

Mandatory

items

Comma-separated list of item property ids to watch.

Comma-separated list of item property ids.

No. Default ““.

URL parameters

items

comma-separated list of item property ids to watch