AF Attribute Reader module
- Last UpdatedJun 19, 2026
- 3 minute read
This module connects to a PI Web API server to retrieve real-time, historical data from asset databases. It retrieves and sends PI System attribute values from configured asset servers and databases to CONNECT flows.
Required settings
The following table lists the required settings for the module.
|
Name |
Requirements |
Purpose |
Default |
|---|---|---|---|
|
Credential |
Required credential |
Username and password credentials for authenticating with the PI Web API server. |
- |
|
Allow Untrusted Certificates |
Boolean |
Enable to allow connections to servers with self-signed certificates. |
false |
|
Target Property |
Length: 1-64 |
The property on the outgoing message that will contain the retrieved data. |
data |
|
Attribute Resource File (Resource)1 |
Optional |
The resource file contains the asset servers or data servers that the module reads from. |
- |
|
Asset Server Name1 |
Length: 0-64 |
The asset server name (must match the resource file server if supplied). |
- |
|
Database Name |
Length: 0-64 |
The database name for additional attributes to monitor. |
- |
|
Additional Attributes |
List |
List of additional attribute names to retrieve from the specified database. |
[] |
|
Keep Properties |
Boolean |
If true, the incoming message will be preserved; otherwise, a new message will be created. |
false |
1For instructions on how to specify attribute targets and correctly reference the asset server name, refer to the "How to specify attribute targets" section.
How to specify attribute targets
You can specify attribute targets for the module using either of the following methods:
-
Use a resource file to define the Asset Framework (AF) relationship structure. This file is a JSON object that identifies the server, database, and attributes.
-
Alternatively, configure the asset server name, database name, and additional attributes settings. You can use either method independently or together. When you use both methods, the output message includes data from all specified sources.
If you use both methods, make sure to reference the same asset server in the resource file and in the manual configuration.
Code example: Reading asset attributes
This code example shows how the module retrieves attribute values from a PI Web API server for the purpose of monitoring industrial equipment.
Configuration settings
-
URL = https://piwebapi.company.com/piwebapi
-
Credential = [Configured credentials]
-
Target Property = data
-
Asset Server Name = ProductionAssets
-
Database Name = PlantEquipment
-
Additional Attributes = ["Element|Temperature", "Element|Pressure"]
Code example: Resource file
The following example shows how the resource file should appear.
Note: The WebId and Metadata fields referenced in the following example are optional in the incoming message. EventFrames use the following file path format: \\AssetServer\AssetDatabase\EventFrame[EventFrameName]|AttributeNam.
{
"Name": "AssetServer",
"WebId": "optional",
"Assets": [
{
"Name": "AssetDatabase",
"WebId": "optional",
"Attributes": {
"AttributeData": [
{
"Name": "Element|Attribute1",
"WebId": "optional",
"Metadata": "optional"
},
{
"Name": "Element\\ChildElement|Attribute2",
"WebId": "optional",
"Metadata": "optional"
},
{
"Name": "EventFrame[MyTestEventFrame]|EFAttribute",
"WebId": "optional",
"Metadata": "optional"
},
{
"Name": "EventFrame[MyTestEventFrame]\\ChildEventFrame|EFAttribute",
"WebId": "optional",
"Metadata": "optional"
}
]
},
"Metadata": "optional"
}
],
"Metadata": "optional"
}
Example: Outgoing message
The following code example provides a sample of an outgoing message.
{
"crosser": {
"success": true
},
"data": {
"Assets": [
{
"Attributes": {
"AttributeData": [
{
"AttributeValue": {
"Timestamp": "2024-01-15T14:30:00Z",
"Value": 75.5
},
"DataReferencePlugIn": "PI Point",
"Metadata": "Optional custom metadata",
"Name": "Element|Temperature",
"Path": "\\\\ProductionAssets\\PlantEquipment\\Pump1|Temperature",
"WebId": "<Base64EncodedWebId>"
},
{
"AttributeValue": {
"Timestamp": "2024-01-15T14:30:00Z",
"Value": 150.2
},
"DataReferencePlugIn": "",
"Metadata": "Optional custom metadata",
"Name": "Element|Pressure",
"Path": "\\\\ProductionAssets\\PlantEquipment\\Pump1|Pressure",
"WebId": "<Base64EncodedWebId>"
}
]
},
"Metadata": "Optional database metadata",
"Name": "PlantEquipment",
"Path": "\\\\ProductionAssets\\PlantEquipment",
"WebId": "<Base64EncodedWebId>"
}
],
"Metadata": "Optional server metadata",
"Name": "ProductionAssets",
"Path": "\\\\ProductionAssets",
"WebId": "<Base64EncodedWebId>"
}
}