Skip to content

camera.getOrganizationCameraDetectionsHistoryByBoundaryByInterval does not pass required query string parameter "ranges" #281

@mpcisco

Description

@mpcisco

Describe how you confirmed the issue is with the library, and not with the API itself, or a server-side issue of some other kind.
When I use this endpoint in Postman, I do not get the same error.

Python version installed
3.13.2

Meraki library version installed
1.54.0

Have you reproduced the issue with the latest version of this library? And with the latest version of Python?
Yes

OS Platform
Windows 11

Describe the bug
I'm trying to write a script that fetches line crossing detections for my MV63 camera. In my script, I use the following line:
detections = dashboard.camera.getOrganizationCameraDetectionsHistoryByBoundaryByInterval(organizationId=ORGANIZATION_ID, boundaryIds=BOUNDARY_IDS, ranges=RANGES)

The items in caps have been set earlier in my script. The error I get is:
meraki.exceptions.APIError: camera, getOrganizationCameraDetectionsHistoryByBoundaryByInterval - 400 Bad Request, {'errors': ["The following required parameters are missing: 'ranges'"]}

When I open the source code for camera.py in the Meraki module, line 897 writes:
array_params = ['boundaryIds', 'boundaryTypes', ]

...which, as far as I can tell, causes the code to not match for a parameter named "ranges".

Ranges, an array of objects, is a required query string item according to documentation: https://developer.cisco.com/meraki/api-v1/get-organization-camera-detections-history-by-boundary-by-interval/

How can we replicate the problem you're reporting?

  1. Have a MV camera that supports line crossing analytics
  2. Define a line crossing boundary on the camera using the Meraki dashboard
  3. Walk in front of the camera to create a line crossing detection
  4. Look up your organization ID and the boundary ID of your camera using Dashboard API:
    https://developer.cisco.com/meraki/api-v1/get-organizations/
    https://developer.cisco.com/meraki/api-v1/get-organization-camera-boundaries-lines-by-device/
  5. Run the following script:
    export MERAKI_DASHBOARD_API_KEY=YOUR_KEY_HERE
    ORGANIZATION_ID = "YOUR_ORG_ID_HERE"
    BOUNDARY_IDS = [YOUR_BOUNDARY_ID_HERE]
    RANGES = [{"interval": 60}, {"startTime":"2025-01-01T00:00:00Z"}, {"endTime":"2025-01-02T00:00:00"}]
    import meraki
    dashboard = meraki.DashboardAPI()
    detections = dashboard.camera.getOrganizationCameraDetectionsHistoryByBoundaryByInterval(organizationId=ORGANIZATION_ID, boundaryIds=BOUNDARY_IDS, ranges=RANGES)
    print(detections)

The second-to-last line will fail and produce the issue.

Expected behavior
The code should print detections, as returned by the Dashboard API.

Code snippets
export MERAKI_DASHBOARD_API_KEY=YOUR_KEY_HERE
ORGANIZATION_ID = "YOUR_ORG_ID_HERE"
BOUNDARY_IDS = [YOUR_BOUNDARY_ID_HERE]
RANGES = [{"interval": 3600}, {"startTime":"2025-01-01T00:00:00Z"}, {"endTime":"2025-01-02T00:00:00"}]
import meraki
dashboard = meraki.DashboardAPI()
detections = dashboard.camera.getOrganizationCameraDetectionsHistoryByBoundaryByInterval(organizationId=ORGANIZATION_ID, boundaryIds=BOUNDARY_IDS, ranges=RANGES)
print(detections)

Additional context
An example of the correct URI to use this endpoint, including required items in query string:
https://api.meraki.com/api/v1/organizations/<ORGANIZATION_ID>/camera/detections/history/byBoundary/byInterval?boundaryIds[]=<BOUNDARY_ID>&ranges[]interval=60&ranges[]startTime=2025-01-01T00:00:00Z&ranges[]endTime=2025-01-02T00:00:00

Edit: I had pasted the wrong API docs link
Edit 2: Fixed errors in formatting the ranges parameter and added example of correct format of query string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions