Motion detection via http command?

Is it possible to start motion detection via a http command?

Yes you can use the JSON API.

Start by reading this: Netcam Studio - Network Camera Surveillance Software

You’ll need a token to be able to authenticate.

Then you can call:
http://localhost:8124/Json/StartStopMotionDetection?sourceId=0&enabled=true&authToken=xxxxxxx

You can also generate the wsdl of the Json API From your instance of NCS, it will probably help you for whatever other commands since there are quite a lot:
http://localhost:8124/?wsdl

1 Like

Super! Thanks, will try this

Hi again, just tried this but get: Endpoint not found.
Any ideas?

Hi,
The command is wrong. StartStopMotionDetection should be StartStopMotionDetector
http://localhost:8124/Json/StartStopMotionDetector?sourceId=0&enabled=true&authToken=xxx

Yes, it works ;).
You have all the commands here:
http://netcamstudio.com/WebAPI/#Moonware.Server.WCF~Moonware.Server.WCF.MoonwareServerWCF~StartStopMotionDetector.html

This was fun! Maybe I do some more interesting stuff with this ;).
-Henrik

1 Like

Awsome! That worked. Now, lets automate :slight_smile:

I have setup capture and start and stop motion detection via commands. I use my home automation system to send the command.

I can get notification when a record has been done, but is that also possible when a capture is done?

Hi!
Going well! With record has been done I assume you mean when a video has been recorded and stored. There I understand why it is interesting to have notification since the length of the recording can differ. However, a capture is instant and only a still picture so that is done at the same time as the command.
-Henrik

I think i explained a bit bad… I want to send a email notification with the picture, as soon as its captured.

No rule for that in NCS. Capture is initialized manually in NCS or by external command. In the command it seems that you can set the file name and if you know the file name you can grab it in the folder and add it to the email.

Hmm, seems like i need to get a new token when the server reboots… any solution to this?

In one of the cammands above the result was a session and a permanent token. The permanent token would survive a reboot.
-Henrik

I have used the permanent token, but that also changes after reboot…

Ok. Need @Steve to have a look at this.
-henrik

No the permanent token should not change, once you have one exit netcam studio properly to ensure it’s saved and restart the software.

If for any reason it crashes or is restarted a bit aggressively (power cut) then it could be that it was not stored on hdd and a new one will be generated next time.

Hello, well… it changes. I generate, test that it works. Exit the server, start the server again. When i test again with the same permanent token, i get this error:

Create a new user, do not use the default admin account for this.

Normally the default Admin should not have a Permanent Token but it has a temporary one for each session for Netcam Studio X to work properly. Even I was confused, I agree that it’s a bit misleading so i’ll modify that the token for default admin is not even visible / accessible.

If you create a new user account (ideally with limited rights only only about what you need), you will get a token that is persisted and won’t change…

1 Like