Web Service Definiton

Started by Egert143, January 21, 2021, 11:33:02 AM

Previous topic - Next topic

Egert143

Hello

Is it possible to extract data with web service from this sample data (its returned in webpage):

{"py/object": "detector.api.Snapshot", "time": 1607485618.4846845, "version": "v1.2.3", "detections": [], "antenna_gps": {"py/tuple": [01.12343455, 02.45542]}, "antenna_gps_locked": true, "antenna_temp": -6.816406250000001, "antenna_yaw": 354.90458852191114, "jamming": false, "is_battery_powered": false, "battery_percent": 0, "suspended": false}

if yes, is it enought to fill in only name and url? Also in dci settings what is the correct parameter for example to get version info ?

Egert

Filipp Sudanov

In current version of NetXMS JSON parser is failing on the leading zeroes of 01.12343455, 02.45542

besides from that the parsert should be able to extract the part you need, e.g. for time the path in document should be just "time".
So DCI parameter would be looking Name_of_your_web_service_definition:time

Egert143

#2
Created Web Service Definition with name and url, also checked "verify the peer's SSl certificate" + "verify the certificate's name against host". Then created DCI with parameter "name:version", origin: web service, type: string and result is unsupported. What should i change ?

Edit: Seems like sometimes the poll is succesful and othertimes it fails.

Filipp Sudanov

As per your example above, JSON parser is failing on this part:
"antenna_gps": {"py/tuple": [01.12343455, 02.45542]}

You can check the syntax e.g. with this tool
https://jsonformatter.curiousconcept.com

So I suppose that the data returned by this web service might change time after time and sometimes the data confirms with what the JSON parser expects.