Security

 View Only
  • 1.  ClearPass API Database Query Error

    Posted Sep 15, 2025 06:03 AM

    I'm trying to use the ClearPass API to retrieve a count of all active sessions from a Python script.

    I'm able to filter the session api by, for example, username but if I try to filter on session "state" (either equals "active", or not equals "closed") I get an Internal Server Error (500), database query error.

    Anyone out there able to test whether this works for them or provide insight as to what I'm getting wrong?

    Thanks



    -------------------------------------------


  • 2.  RE: ClearPass API Database Query Error

    Posted Sep 16, 2025 01:25 PM

    Have you checked this link https://developer.arubanetworks.com/cppm/docs/rest-api-filtering

    Maybe you have necessary information there.

    I am not an expert on this, but i think you should send:

    POST https://<clearpass>/api/session?calculate_count=true&limit=1
    Authorization: Bearer <token>
    Content-Type: application/json

    {
      "filter": {
        "acctstoptime": { "$exists": false }
      }
    }

    So from the link provided i think you should be filtering by state. Instead, you should filter by acctstoptime, and use ?calculate_count=true to get the total. 



    ------------------------------
    Shpat | ACEP | ACMP | ACCP | ACDP
    Just an Aruba enthusiast and contributor by cases
    If you find my comment helpful, KUDOS are appreciated.
    ------------------------------