Can't enable (& disable) a configured cam/video source via WebAPI

There is more on the scenario here:

though in short, i have two scripts which amount to:
Arm Cameras with 30sec delay
DisARM NCS system cameras

and while 2 of the cameras are standard security cams, 1 other is my tablet/laptop built-in webcam. I want it enabled and active for motion detection/recording while the system is ARM’ed, but when the system is NOT armed, i want it entirely released from NCS (available for other apps, not watching me, etc. Though when i’m away from the house, i’d like to see if anyone sits at my keyboard).

So, since i’ve scripted the 2 arm/disarm scripts in powershell (and am not otherwise utilizing/running the NCS client… but rather utilizing the NCS service directly via scripts)… i would like as part of the Powershell ARM script to be able to utilize what i’ve found under http://localhost:8124/?singlewsdl: as… ConnectCamera and DisconnectCamera

ie.
#Enable source: PC/tablet built-in screen webcam
$URLEnableCam3 = “http://localhost:8124/Json/ConnectCameraJson?sourceId=3&enabled=true&authToken=MyTokenHere
Invoke-WebRequest -Uri $URLEnableCam3

and similarly in the disarm script to be able to:
http://localhost:8124/Json/DisconnectCamera?sourceId=3&authToken=MyTokenHere

but it seems these are not implemented, or are non-functional as implemented present?
Is this known/expected? and on a bug list to be prioritized as deemed appropriate, and accordingly addressed? or perhaps it’s user syntax error wrt how i’m improperly calling that method (and similarly disconnect which i can’t get to function)-- and someone can clarify further how i can properly call Connect & Disconnect methods?

When i try the ‘Connect’ method as above, i get the following exception error:
Invoke-WebRequest : Request Error
The server encountered an error processing the request. The exception message is ‘Value cannot be null. Parameter
name: value’. See server logs for more details. The exception stack trace is:
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at
Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at
Moonware.Server.WCF.MoonwareServerWCF.d__31.MoveNext() — End of stack trace from previous
location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at
System.ServiceModel.Dispatcher.TaskMethodInvoker.d__16.MoveNext() — End of stack trace from previous
location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at
System.ServiceModel.Dispatcher.TaskMethodInvoker.InvokeEnd(Object instance, Object& outputs, IAsyncResult result) at
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeEnd(MessageRpc& rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage7(MessageRpc& rpc) at
System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
At C:\Users\msein_000\Documents\NCSScript\ArmNCS.ps1:20 char:1

  • Invoke-WebRequest -Uri $URLEnableCam3
  •   + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
     eption
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
    
    

thanks and best regards-- PapaMarc

It’s been a while. I’ve tried a range of things but at least from Json, i’ve been unable to connect/disconnect a camera… whereas start/stopping motion for a connected camera works great.

I merged my two scripts into one Arm/DisArmWithDelay console prototype:

in reviewing the webclient, i see it too doesn’t enumerate cams which are configured but not presently enabled/connected (giving the option to enable/connect them), nor to disconnect enumerated enabled/connected cams-- though if/when a disabled cam is enabled/connected in the full client then both the web or full client enumerates it and allows for ‘record on motion’ to be enabled/disabled. I’d like to be able to connect/disconnect configured cams from within my PowerShell script v. only manually in the full client.
eg. lines 206-208 and variants thereof which i’ve tried aren’t working for me.
Any feedback/suggestion would be greatly appreciated.

Hi,
The web client is intended for a user and not for an administrator so therefore the simplified Interface.
Enable/disable a camera is on the list to also be in the API.
Disconnect/connect will not be in the API since that process is a configuration of the camera.
-Henrik

Thanks for the prompt response! Sorry if i was conflating the enable/disable and connect/disconnect (on trying to map what i saw in the interface with what i saw in the UI)… the feature i’d like to access programmatically from script (to toggle on/off, a kin to how i can toggle on/off motion recording), is called ‘source enabled/online’ (and can be selected/deselected) in the ‘NetCam Studio Client 64-bit’ interface. Thanks for confirming it’s not yet implemented, but is on the prioritized list to add to the web accessible API-- GREATLY APPRECIATED. I’ll keep an eye out for the update.
No worries re: the web client-- wasn’t requesting a feature perse, but just trying to find an example of how to do what i was attempting to accomplish and noting that i wasn’t able to find an example of it in that UI or code. Again-- many thanks.

btw-- is there a more canonical place for viewing current version and change log than:
https://community.netcamstudio.com/t/netcam-studio-change-log

i’m running 64-bit v1.9.2 though notice that link for the change log doesn’t include 1.9.2 (which i gather is the current/latest) version.
Other than periodically downloading and reinstalling… with each release is there a better place to monitor for version updates, indication of current version & date of release, along with some reference to introduction of a new export a kin to:
http://localhost:8124/Json/EnableCameraJson?sourceId=3&enabled=<true/false>&authToken=MyTokenHere”