archiver-appliance / epicsarchiverap

This is an implementation of an archiver for EPICS control systems that aims to archive millions of PVs.
Other
39 stars 38 forks source link

getPVStatus ignores POST body #49

Closed willrogers closed 6 years ago

willrogers commented 6 years ago

The documentation for the getPVStatus BPL call suggests that you can send the requested PVs in a POST. As far as I can tell, it is ignoring the post and it works only if the PVs are added to the URL.

I can figure out how to fix this if you like @slacmshankar.

slacmshankar commented 6 years ago

You are right; I think this is a bug.

I'll try to fix it by the end of this week. Please feel free to fix/ping me if I do not get back to you.

slacmshankar commented 6 years ago

This does seem to support application/x-www-form-urlencoded POST's. However, it does not support the full fledged POST with JSON etc. Is that what you were looking for?

$ cat pvs.txt
pv=XCOR:LI21:101:BDES,XCOR:LI21:101:EDES,XCOR:LI21:402:BDES
$ curl -XPOST --data @pvs.txt "http://localhost:17665/mgmt/bpl/getPVStatus"
[
{"lastRotateLogs":"Never","appliance":"test-arch","pvName":"XCOR:LI21:101:BDES","pvNameOnly":"XCOR:LI21:101:BDES","connectionState":"true","lastEvent":"Mar\/05\/2018 17:13:58 -08:00","samplingPeriod":"1.0","isMonitored":"true","connectionLastRestablished":"Never","connectionFirstEstablished":"Mar\/05\/2018 17:08:00 -08:00","connectionLossRegainCount":"0","status":"Being archived"},
{"lastRotateLogs":"Never","appliance":"test-arch","pvName":"XCOR:LI21:101:EDES","pvNameOnly":"XCOR:LI21:101:EDES","connectionState":"true","lastEvent":"Mar\/05\/2018 17:08:00 -08:00","samplingPeriod":"1.0","isMonitored":"true","connectionLastRestablished":"Never","connectionFirstEstablished":"Mar\/05\/2018 17:08:00 -08:00","connectionLossRegainCount":"0","status":"Being archived"},
{"lastRotateLogs":"Never","appliance":"test-arch","pvName":"XCOR:LI21:402:BDES","pvNameOnly":"XCOR:LI21:402:BDES","connectionState":"true","lastEvent":"Mar\/05\/2018 17:08:00 -08:00","samplingPeriod":"1.0","isMonitored":"true","connectionLastRestablished":"Never","connectionFirstEstablished":"Mar\/05\/2018 17:08:00 -08:00","connectionLossRegainCount":"0","status":"Being archived"}]
$ 
willrogers commented 6 years ago

I tried a few things, but I obviously didn't manage to get the MIME-type and the body syntax correct at the same time. The documentation isn't wrong though and it works now.

Sorry!