Overview
Client-mode REST API connectors for PTC Kepware Server (KEPServerEX, ThingWorx Kepware Server, Kepware Edge): read server about and health, list channels, devices, tag groups and tags, create, update and delete tags through the Configuration API, read the event log, and browse, read and write live tag values through the IoT Gateway REST server. This is one of the templates in the Kepware (PTC KEPServerEX, ThingWorx Kepware Server, Kepware+) REST API app (kepware). Deploy it alongside the other connectors of that app when they depend on each other (for example a token connector plus an API connector).
Auth
Auth headers used by the template:Authorization: {value.json.authorization}.
Template parameters
| Placeholder | Type | Description | Required |
|---|---|---|---|
RouteName | string | Name of the Kepware Config connector | no |
BaseUrl | string | Kepware Config base URL without trailing slash (e.g. http://YOUR_KEPWARE_HOST:57412) | yes |
BASE_ADDRESS default: http://YOUR_KEPWARE_HOST:57412.
Events
| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
|---|---|---|---|---|---|
GetAbout | GET | /config/v1/about | historian/kepware/about/get | historian/kepware/about/get/response | authorization |
GetStatus | GET | /config/v1/status | historian/kepware/status/get | historian/kepware/status/get/response | authorization |
GetProject | GET | /config/v1/project | historian/kepware/project/get | historian/kepware/project/get/response | authorization |
ListChannels | GET | /config/v1/project/channels | historian/kepware/channel/list | historian/kepware/channel/list/response | authorization |
GetChannel | GET | /config/v1/project/channels/{value.json.channel} | historian/kepware/channel/get | historian/kepware/channel/get/response | authorization, channel |
ListDevices | GET | /config/v1/project/channels/{value.json.channel}/devices | historian/kepware/device/list | historian/kepware/device/list/response | authorization, channel |
GetDevice | GET | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device} | historian/kepware/device/get | historian/kepware/device/get/response | authorization, channel, device |
ListTags | GET | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags | historian/kepware/tag/list | historian/kepware/tag/list/response | authorization, channel, device |
GetTag | GET | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags/{value.json.tag} | historian/kepware/tag/get | historian/kepware/tag/get/response | authorization, channel, device, tag |
CreateTags | POST | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags | historian/kepware/tag/create | historian/kepware/tag/create/response | authorization, body, channel, device |
UpdateTag | PUT | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags/{value.json.tag} | historian/kepware/tag/update | historian/kepware/tag/update/response | authorization, body, channel, device, tag |
DeleteTag | DELETE | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags/{value.json.tag} | historian/kepware/tag/delete | historian/kepware/tag/delete/response | authorization, channel, device, tag |
ListTagGroups | GET | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tag_groups | historian/kepware/tag-group/list | historian/kepware/tag-group/list/response | authorization, channel, device |
ListGroupTags | GET | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tag_groups/{value.json.group}/tags | historian/kepware/group-tag/list | historian/kepware/group-tag/list/response | authorization, channel, device, group |
CreateGroupTags | POST | /config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tag_groups/{value.json.group}/tags | historian/kepware/group-tag/create | historian/kepware/group-tag/create/response | authorization, body, channel, device, group |
GetEventLog | GET | /config/v1/event_log?{value.json.query} | historian/kepware/event-log/get | historian/kepware/event-log/get/response | authorization, query |
Deploy
Get the template card (JSON withtemplate and metadata) from the broker, then deploy the connector:
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode KEPWARE_CONFIG"
BASE_ADDRESS already filled in:
DEFINE ROUTE KepwareConfig WITH TYPE REST_API
ADD REST_API_CONFIG
WITH BASE_ADDRESS "http://YOUR_KEPWARE_HOST:57412"
WITH ENABLE_CLIENT "true"
WITH USE_SSL "false"
WITH REQUEST_TIMEOUT '30'
WITH DEFAULT_CONTENT_TYPE "application/json"
ADD EVENT GetAbout
WITH SOURCE_TOPIC "historian/kepware/about/get"
WITH DESTINATION_TOPIC "historian/kepware/about/get/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/about"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT GetStatus
WITH SOURCE_TOPIC "historian/kepware/status/get"
WITH DESTINATION_TOPIC "historian/kepware/status/get/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/status"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT GetProject
WITH SOURCE_TOPIC "historian/kepware/project/get"
WITH DESTINATION_TOPIC "historian/kepware/project/get/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT ListChannels
WITH SOURCE_TOPIC "historian/kepware/channel/list"
WITH DESTINATION_TOPIC "historian/kepware/channel/list/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT GetChannel
WITH SOURCE_TOPIC "historian/kepware/channel/get"
WITH DESTINATION_TOPIC "historian/kepware/channel/get/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT ListDevices
WITH SOURCE_TOPIC "historian/kepware/device/list"
WITH DESTINATION_TOPIC "historian/kepware/device/list/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT GetDevice
WITH SOURCE_TOPIC "historian/kepware/device/get"
WITH DESTINATION_TOPIC "historian/kepware/device/get/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT ListTags
WITH SOURCE_TOPIC "historian/kepware/tag/list"
WITH DESTINATION_TOPIC "historian/kepware/tag/list/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT GetTag
WITH SOURCE_TOPIC "historian/kepware/tag/get"
WITH DESTINATION_TOPIC "historian/kepware/tag/get/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags/{value.json.tag}"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT CreateTags
WITH SOURCE_TOPIC "historian/kepware/tag/create"
WITH DESTINATION_TOPIC "historian/kepware/tag/create/response"
WITH METHOD "POST"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Content-Type" "application/json"
ADD "Authorization" "{value.json.authorization}"
WITH BODY "{value.json.body}"
ADD EVENT UpdateTag
WITH SOURCE_TOPIC "historian/kepware/tag/update"
WITH DESTINATION_TOPIC "historian/kepware/tag/update/response"
WITH METHOD "PUT"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags/{value.json.tag}"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Content-Type" "application/json"
ADD "Authorization" "{value.json.authorization}"
WITH BODY "{value.json.body}"
ADD EVENT DeleteTag
WITH SOURCE_TOPIC "historian/kepware/tag/delete"
WITH DESTINATION_TOPIC "historian/kepware/tag/delete/response"
WITH METHOD "DELETE"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tags/{value.json.tag}"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT ListTagGroups
WITH SOURCE_TOPIC "historian/kepware/tag-group/list"
WITH DESTINATION_TOPIC "historian/kepware/tag-group/list/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tag_groups"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT ListGroupTags
WITH SOURCE_TOPIC "historian/kepware/group-tag/list"
WITH DESTINATION_TOPIC "historian/kepware/group-tag/list/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tag_groups/{value.json.group}/tags"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
ADD EVENT CreateGroupTags
WITH SOURCE_TOPIC "historian/kepware/group-tag/create"
WITH DESTINATION_TOPIC "historian/kepware/group-tag/create/response"
WITH METHOD "POST"
WITH ENDPOINT "/config/v1/project/channels/{value.json.channel}/devices/{value.json.device}/tag_groups/{value.json.group}/tags"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Content-Type" "application/json"
ADD "Authorization" "{value.json.authorization}"
WITH BODY "{value.json.body}"
ADD EVENT GetEventLog
WITH SOURCE_TOPIC "historian/kepware/event-log/get"
WITH DESTINATION_TOPIC "historian/kepware/event-log/get/response"
WITH METHOD "GET"
WITH ENDPOINT "/config/v1/event_log?{value.json.query}"
WITH HEADERS
ADD "Accept" "application/json"
ADD "Authorization" "{value.json.authorization}"
-addRoute (do not include ADD METADATA).
Usage example
CallGetAbout by publishing a JSON payload to its request topic, and read the reply on the response topic:
mosquitto_sub -t 'historian/kepware/about/get/response' &
mosquitto_pub -t 'historian/kepware/about/get' -m '{"authorization": "<authorization>"}'

