Motion detection via http command?


#1

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


Delete video using WebAPI Methods
Switch to to turn on/off motion detection for all cameras easily
#2

Yes you can use the JSON API.

Start by reading this: http://netcamstudio.com/WebService

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


#3

Super! Thanks, will try this


#4

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


#5

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


Httpget to record
#6

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


#7

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?


#8

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


#9

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


#10

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.


#11

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


#12

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


#13

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


#14

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


#15

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.


#16

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:


#17

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…