Data source configuration
- Last UpdatedSep 25, 2025
- 6 minute read
For each instance of the adapter defined in system configuration, you must configure the data source from which it will receive data.
Configure OPC UA data source
Note: You cannot manually configure data source configurations. You must use the endpoints to add or edit the configuration.
To configure the data source:
-
Using any text editor, create a file that contains an data source in format.
-
Modify the parameters in the example to match your environment.
-
Save the file to the device with installed using a file name based on the adapter instance name. For example, to use the adapter instance created during installation, which is OpcUa1, name the file OpcUa1Datasource.json.
-
Use any tool capable of making requests to execute a command with the contents of that file to the following endpoint: http://localhost:<port_number>/api/v1/configuration/<EDS_adapterId>/DataSource/.
Definition: The POST method is used to create new resources.
The following examples show the request using and EdgeCmd utility using the adapter instance created during installation, which is OpcUa1:
curl -d "@OpcUa1DataSource..json" -H "Content-Type: application/json" "http://localhost:5590/api/v1/configuration/OpcUa1/DataSource"
edgecmd set dataSource -cid OpcUa1 -file OpcUa1DataSource.json
Note: After completing data source configuration, you need to configure data selection next. You can either generate a default data selection file or create the data selection file manually.
Export OPC UA dynamic variables
The adapter is able to export available dynamic variables by browsing the hierarchies or sub-hierarchies as part of the data source configuration process.
-
To limit browsing, specify a comma-separated collection of nodeIds in data source configuration file using the RootNodeIds parameter.
Note: The nodeIds are treated as roots from which the adapter starts the browse operation.
The adapter triggers an export operation after a successful connection to the server when the data selection file does not exist in configuration directory.
-
Copy the exported data selection file from the directory or retrieve it using a call.
-
(Optional) To avoid a potentially long and resource-intensive browse operation, create the data selection file manually. Configure it before you configure the data source or push both in one configuration call together.
Parameters for data source
The following parameters are available for configuring an data source:
|
Parameter |
Required |
Type |
Description |
|---|---|---|---|
|
endpointURL |
Required |
string |
The endpoint of the server in opc.tcp format. The following is an example of the format: opc.tcp://OPCServerHost:Port/OpcUa/SimulationServer Note: If you change the EndpointURL on a configured adapter that has ComponentID_DataSelection.json file exported, you need to remove the ComponentID_DataSelection.json file from the configuration directory to trigger a new browse (export). Allowed value: well-formed opc.tcp address |
|
useSecureConnection |
Optional |
boolean |
When set to true, the adapter connects to a secure endpoint using certificate exchange operation. The default is true. When set to false, the adapter connects to an unsecured endpoint of the server and certificate exchange operation is not required. Note: We recommend setting this option to false for testing purposes only. Allowed value: true or false Default value: true |
|
userName |
Optional |
string |
User name for accessing the server. Allowed value: any string Default value: null |
|
password |
Optional |
string |
Password for accessing the server. Note: We recommend using to configure the data source when the password must be specified because will encrypt the password. If you do not use , the plain text password is stored on-disk. Allowed value: any string Default value: null |
|
incomingTimestamp |
Optional |
string |
Specifies whether the incoming timestamp is taken from the source, from the server, or should be created by the adapter instance.
|
|
streamIdPrefix |
Optional |
string |
Specifies what prefix is used for Stream IDs. The naming convention is {StreamIdPrefix}{StreamId}. An empty string means no prefix will be added to the Stream IDs and names. A null value defaults to ComponentID followed by a period. Example: OpcUa1.{NamespaceIndex}.{Identifier} Note: Every time you change the StreamIdPrefix of a configured adapter, for example when you delete and add a data source, you need to restart the adapter for the changes to take place. New streams are created on adapter restart and pre-existing streams are no longer updated. Allowed value: any string Default value: null |
|
defaultStreamIdPattern |
Optional |
string |
Specifies the default stream Id pattern to use. Possible parameters: {NamespaceIndex}1, {Identifier}. Allowed value: any string Default value: {NamespaceIndex}.{Identifier} |
|
dataCollectionMode |
Optional |
string |
Specifies the data collection mode the adapter is in. The following data collection modes are available:
|
1 NamespaceIndex refers to the number specified in the ns keyword in the RootNodeIds parameter.
2 Historical values are collected only for items that have the AccessLevel attribute set to HistoryRead.
data source examples
The following are examples of valid data source configurations:
Minimal data source configuration
[
{
"endpointUrl": "opc.tcp://<IP-Address>:<Port>/<TestOPCUAServer>"
}
]
Complete data source configuration
[
{
"endpointUrl": "opc.tcp://<IP-Address>:<Port>/<TestOPCUAServer>",
"useSecureConnection": true,
"userName": null,
"password": null,
"incomingTimestamp": "Source",
"streamIdPrefix": null,
"defaultStreamIdPattern": "{NamespaceIndex}.{Identifier}",
"dataCollectionMode": "CurrentWithBackfill"
}
]
REST URLs
|
HTTP verb |
Relative URL |
Action |
|---|---|---|
|
api/v1/configuration/<ComponentId>/DataSource |
Retrieves the data source configuration. |
|
|
api/v1/configuration/<ComponentId>/DataSource |
Creates the data source configuration. The adapter starts collecting data after the following conditions are met: - The data source configuration request is received. Definition: The POST method is used to create new resources. - A data selection configuration is active. |
|
|
api/v1/configuration/<ComponentId>/DataSource |
Configures or updates the data source configuration. Overwrites any active data source configuration. If no configuration is active, the adapter starts collecting data after the following conditions are met: - The data source configuration request is received. Definition: The PUT method is used to replace an existing resource with an updated version. - A data selection configuration is active. |
|
|
api/v1/configuration/<ComponentId>/DataSource |
Deletes the data source configuration. After the request is received, the adapter stops collecting data. |
Note: Replace ComponentId with the Id of your OPC UA component, for example OpcUa1.