Example OPC-UA Device Provisioning Using the REST API

This topic provides the JSON payloads and cURL commands required to setup an example OPC-UA connection.

For information on the Edge Xpert OPC-UA Device Service, see OPC-UA.

OPC-UA Example JSON

The following JSON payloads and cURL commands can be used to setup the OPC-UA example:

  1. To setup the Profile, enter the following command:

    curl localhost:48081/api/v1/deviceprofile/uploadfile -F "file=@/usr/share/edgexpert/examples/opc-ua/prosys-opc-ua-simulation-server-profile.yaml"
    
  2. To setup the Device Service, enter the following command:

    curl --request POST \
      --url http://localhost:48081/api/v1/device \
      --header 'content-type: application/json' \
      --data '{
        "name" :"prosys-opc-ua-simulation-server1-address",
        "description":"Example OPCUA Server",
        "adminState":"UNLOCKED",
        "operatingState":"ENABLED",
        "protocols":{
          "OPC-UA":{
            "Address", "172.17.0.1:53530/OPCUA/SimulationServer"
            "Security", "Basic256Sha256"
            "Certificate":"certificate.der",
            "PrivateKey":"private_key.der"
            "SecurityMode", "SignEncrypt"
          }
        },
        "labels":[
          "OPCUA"
        ],
       "service":{
          "name":"device-opcua"
        },
        "profile":{
          "name":"Prosys OPC-UA Simulation Server - Profile"
        }
      }'
    

Note

This example assumes that there is no Application URI in the certificate. If the certificate contains an Application URI, this must be specified or the OPC-UA Device Service cannot connect to the OPC-UA server.

Viewing Readings

For information on viewing the readings, see Viewing The Readings.