I’ve noticed that a single hardware device can have multiple cameras under it, and identifying the active camera can be challenging because we need to fetch all cameras related to that hardware and then check each one individually.
However, I also saw that when the camera’s Channel = 0, it always seems to be the active one.
Can I rely on this behavior, or is it possible for the active camera to have a different channel number
When speaking of Axis cameras channel 0 will work out of the box, this is a default setup, while additional cameras require that your in the cameras own interface setup additional view areas. Note that the setup can later be changed to not follow the defaults.
I cannot guarantee there is no exception to this in some camera models, especially if we also include cameras of other makes I have no overview of default behaviors.
The rule does not apply if we speak of video encoders which in nature often hosts multiple analog cameras.
So the honest answer is, no, you can neither rely on the camera in channel one to be active nor that others are not active (but it is often so because of default behaviors).
do you have an endpoint for getting all devices under an hardware?
instead of just listing all cameras and speaker for example and find the match hardware in the relations
Yes!
For one Hardware
/api/rest/v1/hardware/[id]?includeChildren=cameras,microphones,speakers,metadata,inputevents,outputs
For all
/api/rest/v1/hardware?includeChildren=cameras,microphones,speakers,metadata,inputevents,outputs
ok thats great for me.
im using this api/rest/v1/hardware?includeChildren=cameras,microphones,speakers,hardwareDriverSettings,motionDetections&page=0&size=10
there is a way to filter some fields so i can reduce the response size?
@Bo Ellegård Andersen (Milestone Systems)
Sample test -
GET /api/rest/v1/hardware?includeChildren=cameras(enabled,displayName,relations)&disabled
and i also tried to perform this request with the includeChildren for an older version of the api and i see its not working
i tried to find something about this in the release notes and didnt find.
i would like to know from which version the REST api supports this.
it does work for example to /api/rest/v1/hardware?includeChildren=hardwareDriverSettings
This works for me, and I guess this is an observation on an older version. Also assume that you find this to work in a newer version. Are my guesses correct?
The includeChildren is not documented and documentation does not say when it was introduced. I will ask Milestone Development if they can improve the documentation in regards to this.
I found indication that includeChildren was available in 2024R3. (Newer versions will also have it.)
thats fine for me thanks.