Details
-
Type: Monitor
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: FIWARE-TECH-HELP
Description
Created question in FIWARE Q/A platform on 13-05-2022 at 13:05
Please, ANSWER this question AT https://stackoverflow.com/questions/72230070/adding-device-to-opc-ua-iot-agent-trough-rest-api-call
Question:
Adding device to OPC-UA IoT Agent trough REST API call
Description:
I'm struggling trying to add a device via API call.
If I start the docker container with the docker-compse.yml, I'm able to load a device to the local OPC-UA server, with the following REST API call.
curl http://localhost:4001/iot/devices -H "fiware-service: opcua_car" -H "fiware-servicepath: /demo" -H "Content-Type: application/json" -d @testCommands/add_device_NGSIv2.json
But, if I start the docker container with the docker-compse-external-server.yml, which instead of the iotagent4fiware/iotagent-opcua:latest uses the iotagent4fiware/iotagent-opcua:1.3.4, and I use the same API call, I get the following error:
{"name":"WRONG_SYNTAX","message":"Wrong syntax in request: Errors found validating request."}From the Docker log:
"op":"IoTAgentNGSI.RestUtils","time":"2022-05-12T19:47:59.467Z","lvl":"DEBUG","msg":"Errors found validating request: {
"valid":false,"errors": [
,
,
,
,
,
,
,
{"attribute":"pattern","property":"devices.0.lazy.0.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=Speed","message":"invalid input"} ]
}
Then, If I run the Agent in Node.js, I get the same error:
{"name":"WRONG_SYNTAX","message":"Wrong syntax in request: Errors found validating request."}If I try to use iotagent4fiware/iotagent-opcua:latest, which should be the same of running the cloned repository in Node.js, it seems to ignore the endpointUrl present in the configuration.properties file, and it try to connect always to opc.tcp://iotcarsrv:5001/UA/CarServer.
Of course, connection fails...
I'm pretty confused from that behaviors, and I can't add anything to the IoTAgent.
2022-05-14 05:31|CREATED monitor | # answers= 0, accepted answer= False