Bulk import devices
AnsweredHi guys
Curious to know if there's a way to import devices in bulk?
This is especially useful when I'm adding via RTSP, since they can only be added using very specific url.
Regards
Kevin
-
Hi Kevin Chen,
I'll check how you can add a list of RTSP streams to a system. I'll get back at you once I know more.
1 -
Hi Kevin Chen,
Unfortunately, there is no straight forward method, but you could use the REST API to achieve your goal.
Below an example of the output for the following GET request:
https://localhost:7001/rest/v1/devices?_format=JSON&_keepDefault=true
The output below is in json, but could be XML or CSV as well.
{
"backupQuality": "CameraBackupDefault",
"capabilities": "shareIp|customMediaUrl|absoluteTimestamps|fixedQuality",
"credentials": {
"password": "<PASSWORD>",
"user": "<USER>"
},
"group": {
"id": "",
"name": ""
},
"id": "{4a928554-cd01-947d-27d9-37c34bb48c49}",
"isLicenseUsed": false,
"isManuallyAdded": true,
"logicalId": "",
"mac": "00-00-00-00-00-00",
"model": "511e67b8-1897-43f1-fc72-d8a8feec2666",
"motion": {
"mask": "",
"recordAfterS": 5,
"recordBeforeS": 5,
"type": "default"
},
"name": "GENERIC_RTSP-511e67b8-1897-43f1-fc72-d8a8feec2666",
"options": {
"backupContentType": "archive",
"backupPolicy": "byDefault",
"backupQuality": "CameraBackupDefault",
"dewarpingParams": "{\"cameraProjection\":\"equidistant\",\"enabled\":false,\"fovRot\":0,\"hStretch\":1,\"radius\":0.5,\"sphereAlpha\":0,\"sphereBeta\":0,\"viewMode\":\"ceiling\",\"xCenter\":0.5,\"yCenter\":0.5}",
"failoverPriority": "Medium",
"isAudioEnabled": false,
"isControlEnabled": true,
"isDualStreamingDisabled": false,
"preferredServerId": "{ff72f898-3067-2685-87a6-1b2e96fabc91}"
},
"parameters": {
"aux_data": "generic_rtsp_plugin_aux",
"bitratePerGOP": 0,
"compatibleAnalyticsEngines": [],
"dontRecordPrimaryStream": "",
"dontRecordSecondaryStream": 1,
"driverClass": "QnThirdPartyResource",
"firmware": "",
"hasDualStreaming": 1,
"isAudioSupported": 1,
"keepCameraTimeSettings": 1,
"mediaCapabilities": {
"hasAudio": false,
"hasDualStreaming": false,
"streamCapabilities": [
{
"key": "primary",
"value": {
"defaultBitrateKbps": 0,
"defaultFps": 0,
"maxBitrateKbps": 0,
"maxFps": 30,
"minBitrateKbps": 0
}
}
]
},
"overrideAr": "",
"rotation": "",
"rtpTransport": "",
"streamFpsSharing": "noSharing",
"streamUrls": {
"1": "rtsp://<addLinkHereForPrimaryStream/>",
"2": "rtsp://<addLinkHereForPrimaryStream/>"
},
"supportedMotion": "softwaregrid",
"trustCameraTime": 0,
"useMedia2ToFetchProfiles": "autoSelect",
"userEnabledAnalyticsEngines": []
},
"physicalId": "516bc407636320456511598b9322a538",
"schedule": {
"isEnabled": false,
"maxArchiveDays": -30,
"maxArchivePeriodS": -2592000,
"minArchiveDays": -1,
"minArchivePeriodS": -86400,
"tasks": [
{
"bitrateKbps": 0,
"dayOfWeek": 1,
"endTime": 86400,
"fps": 15,
"metadataTypes": "motion",
"recordingType": "metadataOnly",
"startTime": 0,
"streamQuality": "high"
},
{
"bitrateKbps": 0,
"dayOfWeek": 2,
"endTime": 86400,
"fps": 15,
"metadataTypes": "motion",
"recordingType": "metadataOnly",
"startTime": 0,
"streamQuality": "high"
},
{
"bitrateKbps": 0,
"dayOfWeek": 3,
"endTime": 86400,
"fps": 15,
"metadataTypes": "motion",
"recordingType": "metadataOnly",
"startTime": 0,
"streamQuality": "high"
},
{
"bitrateKbps": 0,
"dayOfWeek": 4,
"endTime": 86400,
"fps": 15,
"metadataTypes": "motion",
"recordingType": "metadataOnly",
"startTime": 0,
"streamQuality": "high"
},
{
"bitrateKbps": 0,
"dayOfWeek": 5,
"endTime": 86400,
"fps": 15,
"metadataTypes": "motion",
"recordingType": "metadataOnly",
"startTime": 0,
"streamQuality": "high"
},
{
"bitrateKbps": 0,
"dayOfWeek": 6,
"endTime": 86400,
"fps": 15,
"metadataTypes": "motion",
"recordingType": "metadataOnly",
"startTime": 0,
"streamQuality": "high"
},
{
"bitrateKbps": 0,
"dayOfWeek": 7,
"endTime": 86400,
"fps": 15,
"metadataTypes": "motion",
"recordingType": "metadataOnly",
"startTime": 0,
"streamQuality": "high"
}
]
},
"serverId": "{ff72f898-3067-2685-87a6-1b2e96fabc91}",
"status": "Unauthorized",
"typeId": "{7b2a1e32-d7ec-7a04-3c64-898ff33ef37c}",
"url": "rtsp://192.168.178.20:7001/511e67b8-1897-43f1-fc72-d8a8feec2666",
"vendor": "GENERIC_RTSP"
}So what you need to do is creating a file (JSON, XML, or CSV) and parse it to the system with a POST request. You could omit settings, to apply them later if you just want to add the device to the system.
Please check the REST API and more specific the DEVICE section for more information.
0 -
Hi
Just to follow-up on this, I don't think I'm good enough to implement that level of coding via your API.
I tried a simple POST test like the following (which is more or less all I need), but it's probably not even close to a working formula. Is there something new in the latest firmware that can help my case?{"url": "rtsp://172.16.0.101:554/Streaming/Channels/102","name": "test",},"credentials": {"user": "admin","password": "password123"},}Just for context I have over 900 rtsp urls to play with. -.-"RegardsKevin0
Please sign in to leave a comment.
Comments
3 comments