Change Camera Name using Surveillance Station API

This forum is for devlopers to discuss questions about apps/plug-ins/extension modules/API specifically developed for using with Synology DiskStations.
Forum rules
1) This is a user forum for Synology users to share experience/help out each other: if you need direct assistance from the Synology technical support team, please use the following form:

https://account.synology.com/support/su ... p?lang=enu



2) To avoid putting users' DiskStation at risk, please don't paste links to any patches provided by our Support team as we will systematically remove them. Our Support team will provide the correct patch for your DiskStation model.
synchronicity
I'm New!
I'm New!
Posts: 3
Joined: Sat Jun 09, 2018 10:33 pm

Change Camera Name using Surveillance Station API

Unread post by synchronicity » Sat Jun 09, 2018 10:52 pm

I'm using Surveillance Station 8.1.5-5513 (which is current as of this post). I want to change the Camera Name for a specific camera via the API. The 2.7 API spec is what I'm referencing ( https://global.download.synology.com/do ... I_v2.7.pdf ).

I can successfully authenticate a user that has the appropriate permissions, and I can retrieve camera data from a List command, eg:

Code: Select all

https://IP_ADDRESS:5001/webapi/entry.cgi?privCamType=3&version="8"&blIncludeDeletedCam=true&streamInfo=true&blPrivilege=false&api="SYNO.SurveillanceStation.Camera"&basic=true&blFromCamList=true&camStm=1&method="List"
I'm trying to use the following REST string to change the Camera Name:

Code: Select all

https://IP_ADDRESS:5001/webapi/entry.cgi?camId=1&version="1"&api="SYNO.SurveillanceStation.Camera.Wizard"&actFromHost=false&data={"camId":1,"camName":"NewCameraName"}&method="CamSaveAll"
However, I always receive the following response/result:

Code: Select all

{
  "error": {
    "code": 400,
    "errors": {
      "param1": "",
      "param2": "",
      "success": false
    }
  },
  "success": false
}
Code 400 most often seems to mean "Execution failed" which isn't terribly informative. :?

The Surveillance Station Log indicates:

Code: Select all

Camera [CURRENT_CAMERA_NAME] failed to be edited.
That log result seems to suggest that I am at least interfacing with the correct camera, but I can't understand why the Edit is unsuccessful.

I've run out of ideas of what else to try. I'm extremely grateful for any help!

synchronicity
I'm New!
I'm New!
Posts: 3
Joined: Sat Jun 09, 2018 10:33 pm

Re: Change Camera Name using Surveillance Station API

Unread post by synchronicity » Mon Jun 25, 2018 5:40 pm

Turns out I was in the wrong part of the API for what I was wanting to accomplish.

I did a bunch of lengthy, tedious testing and it looks to me that the API for the CamSaveAll method does not currently allow one to just modify/edit one parameter, but rather it wants you to send a request with all of the parameters included (which consequently means you're updating everything regarding that camera, and not just the name).

Thankfully, a very helpful tech support person suggested I check out the SYNO.SurveillanceStation.Camera "Save" method on page 32 of the API guide, and that turned out to be what I was needing.

Here's the string that worked, and it functions just like I was hoping (note that "id" is the id of the camera you want to edit):

Code: Select all

https://IP_ADDRESS:5001/webapi/entry.cgi?api=SYNO.SurveillanceStation.Camera&method="Save"&version=9&id=1&newName="NEW_NAME"
:D

Post Reply

Return to “Developer Discussion Room”