#993 watchSub, watchUnsub & watchPoll examples

Jason Ellwood Tue 24 May 2022

Hi,

Is anyone able to provide me with examples of the aforementioned requests as I'm having difficulty. I'm looking specifically at the nHaystack implementation but any general examples would help me.

Some examples below of my trial and error attempts using Postman

https://xxx.xxx.co.uk/haystack/watchSub?filter=point and [email protected]&watchDis=testWatch&lease=30min

https://xxx.xxx.co.uk/haystack/watchPoll?watchId=testWatch

Brian Frank Tue 24 May 2022

First off, I would encourage you to use POST instead of GET. Using GET should be restricted to just requests without side-effects.

Here is quick example in Zinc:

POST http://localhost:8080/api/demo/watchSub
Authorization: bearer authToken=xyz
Content-Length: 126
Content-Type: text/zinc; charset=utf-8
Accept-Encoding: gzip
ver:"3.0" watchDis:"Foo" lease:1min curValSub
id
@p:demo:r:29faae2b-0c6c8361
@p:demo:r:29faae2b-8cbf792c

Date: Tue, 24 May 2022 11:23:37 GMT
Content-Type: text/zinc; charset=utf-8
ver:"3.0" watchId:"w-2a1f7cb9-686e53a5" lease:1min
id, ...
@p:demo:r:29faae2b-0c6c8361 "Carytown ElecMeter-Main kW",...
@p:demo:r:29faae2b-8cbf792c "Carytown RTU-1 DischargeTemp",...

POST http://localhost:8080/api/demo/watchPoll
Authorization: bearer authToken=xyz
Content-Length: 57
Content-Type: text/zinc; charset=utf-8
Accept-Encoding: gzip
ver:"3.0" watchId:"w-2a1f7cb9-686e53a5" curValSub
empty

200 OK
Date: Tue, 24 May 2022 11:23:37 GMT
Content-Type: text/zinc; charset=utf-8
ver:"3.0" watchId:"w-2a1f7cb9-686e53a5"
id,curVal,curStatus
@p:demo:r:29faae2b-8cbf792c "Carytown RTU-1 DischargeTemp",64.1°F,"ok"
@p:demo:r:29faae2b-0c6c8361 "Carytown ElecMeter-Main kW",864kW,"ok"

Login or Signup to reply.