List the cameras in a project
Find the cameras on a site and pick one that will actually return an image.
UsesDash API
Once you have a project's exid, its cameras are one request away.
The cameras belonging to one project.
curl -H "Authorization: Bearer $EVERCAM_TOKEN" \
"https://media.evercam.io/v2/projects/$PROJECT_EXID/cameras"Each camera has an exid, a name, a status and a timezone.
Picking a camera that returns imagery
status is the obvious filter, but it is not sufficient:
const online = cameras.filter((camera) => camera.status === "online")Online does not guarantee a stored snapshot
Cameras reporting online regularly return 404 from the snapshot endpoint,
and availability changes minute to minute. Handle that 404 as an empty
state and fall back to another camera rather than surfacing an error.
The reliable approach is to try the snapshot and move on if it is missing:
async function firstCameraWithImage(cameras, token) {
for (const camera of cameras) {
const res = await fetch(
`https://media.evercam.io/v2/cameras/${camera.exid}/recordings/snapshots/latest`,
{ headers: { Authorization: `Bearer ${token}` } },
)
if (res.ok) {
return { camera, snapshot: await res.json() }
}
}
return null
}All cameras, across projects
Every camera your account can see, paginated.