Skip to content

Web Server Specifications and API

edited January 2019 in SecuritySpy
Hello,

Is there an up to date version of this page? https://www.bensoftware.com/securityspy/web-server-spec.html

Most of the methods described here have been expanded, and I'm guessing there are new methods not documented. The ++getfile method isn't documented at all, but referenced by ++download and expected to be used by consumers. I'm writing a full-featured Golang library for the SecuritySpy API; having accurate docs will certainly speed up the process.

Thanks!

Comments

  • Are there any examples available of how to use ++eventStream? I'm trying to test it with curl and simply getting zilch for output. Curl "hangs open" like it's waiting for data, but nothing is ever printed; even if I go force things to happen like arm/disarm. The following is an example. Curl never exits, and nothing is ever printed again.

    $ curl -is "127.0.0.1:8000/++eventStream/"
    HTTP/1.1 200 OK
    Server: BBVS/4.0
    Cache-Control: max-age=0, must-revalidate
    Pragma: no-cache
    Keep-Alive: timeout=20, max=100
    Connection: Keep-Alive
    SS-UUID: C03L1333F8J3AkXIZS1O
    Content-Type: text/plain
  • Adding -N to curl to remove the buffer helps, but the lines printed appear to be missing carriage returns. Very odd output indeed; I'd love to see client code (in any language) that works with this stream. The (cynic) Indigo plugin I once used caused high CPU load, so a different example would be ideal.
  • edited January 2019
    I'm quickly cooking up a list of "I wish I had..." - is there anywhere in particular you'd like to see API feature requests? We can start with: Can we put the server timezone in ++systemInfo?

    EDIT: A local timestamp as one of the output fields that includes the time zone would probably be best. Then it's easy to identify the server's time as skewed.
  • I would love more documentation, with examples.
  • BenBen
    edited January 2019
    I'm happy to document the requests that aren't currently documented (e.g. ++getfile). Please let me know any other "hidden" requests you need, or any further clarification to existing documented requests.

    As for ++eventStream - curl won't render this properly, as it will be waiting for the end of the data, which never comes. You'll have to use an alternative method where you have access to the data as it comes in. Lines are terminated by CR (Ox13) rather than LF (0x10).

    We can add both the time zone and current time in ++systemInfo in the next update.
  • I'll write my list of requests. A lot of it revolves around documenting the XML data that is returned. i.e., what is each field a presentation of. I've also run across typos/un-edited copy/pastas and missing data, like the bitwise mask for ptz caps. Would you like my list pasted here, or into an email? Thanks!
  • If anyone is interested in interacting with SecuritySpy using Golang, please open an Issue under this project and tell me your use case. https://github.com/davidnewhall/go-securityspy/pull/1
  • OK it sounds like there might be a number of things to over, so perhaps it's best in an email - please send the list to support@bensoftware.com and we'll do our best to accommodate your requests (and please let us know about any typos in the documentation, no matter how small - we'll definitely want to fix all of these!).
  • Email Sent. Hope it's helpful!
  • Oh, and for anyone looking for a way to watch the event stream (++eventStream) with curl, use tr to change \r to \n. like this:

    curl -sN "127.0.0.1:8000/++eventStream/" | tr '\r' '\n'
  • The updates on this page are great! Thank you so much for updating the docs! The new go library supports nearly everything provided in the API, but I have a few more things to add with the new doc exposing previously-unknown methods.

    I also put together a simple CLI tool that prints out camera info, or event stream data. Find it here: https://github.com/davidnewhall/SecSpyCLI - I'll add some docs on how to use it soon, but the tech savvy can probably figure it out pretty quick. If anyone has other use cases for a CLI tool, please let me know through a github issue request.
  • @frankyhall How do I build it?
  • Package are available now so you don't have to build it.
  • This is pretty cool. Seems to be working well.

    One thing I'm noticing...

    If I use -c files -a CAMNAME:# the list of files returned shows 0MB for the size (all JPG images in this case). I assume it's rounding down to 0MB because the files are all around 432 KB.
  • Thinking about this in relation to my thread about event handling when a movie file is recorded...

    https://bensoftware.com/forum/discussion/2818/motionimage-recording-action-handoff-movieimage-to-script#Item_4

    If SecuritySpy included notifications in the event stream that indicated the start and completion of a motion recording, ie, 'Started motion recording ' event and 'Finished motion recording ', then I guess I could monitor the event stream for those messages, parse for the filename, then hand it off to my logic for further processing.

    Would be cool if the event stream could provide structured data, ie json.

  • edited July 2019
    Franky - seems like password escaping is not working properly for me with your tool. Try setting up a user 'test' with password 'test1234' or try a password that requires escaped chars ie, 'p@ss=word'. The latter also doesn't work if I write the escape values ie 'p%40ss%3Dword'
  • Sorry, missed this thread update! That problem turned out to be an encoding issue, and will be fixed in the next release of SecuritySpy. For now, it's fixed in the beta version. If you need v4 with this fix, that is also available. Thanks for that @Ben!
Sign In or Register to comment.