I'm logging current connection information into endpoint attribute like that (for different reasons, but can help you).
Original Message:
Sent: Apr 09, 2025 04:23 AM
From: samh
Subject: ClearPass API Call
Thanks for the reply. Screenshot shows ClearPass > Configuration > Endpoints > Endpoint info i'm trying to get using the ClearPass API, not sure why the screenshot failed at the time of posting. I did manually view the complete /session items json response to see if I could find the endpoint, but didn't find the mac address. I will read up on /session as I don't really understand what it does to be honest, nothing i'm searching for ever exists in it anyway it seems so maybe I need to configure it, I'm not sure?

We only use Aruba Central to manage 15 switches on one new site currently so that API isn't going to be practical. ClearPass is used on all switches across all sites which is why I'm hoping a ClearPass API solutions gets me to a solution. Basically enter mac-address or device and response tells user what switch IP and port the device is on.
Edit: I do notice we only have switches in the session, not devices so that'll be why there's nothing found in /sessions filter it seems.
If needs must I'll use a Selenium IDE Chrome Web Scrape instead of ClearPass API, but i'm hoping not.
Original Message:
Sent: Apr 09, 2025 03:33 AM
From: sdemets
Subject: ClearPass API Call
Hi Samh,
I've tried this om our ClearPass and I get the correct session. Have you checked in the ClearPass Guest Manager GUI if there are any active sessions for that MAC address?
Either way, I think it would be better to use the mac address with an API call to your network management platform (Airwave/Central/...) to get this kind of information.
Also, you talk of a screenshot, but none is attached to you post.
Hope this helps,
Steven
------------------------------
Steven Demets
Original Message:
Sent: Apr 07, 2025 11:48 AM
From: Sam Hocking
Subject: ClearPass API Call
I'm struggling to find an API call that will return the Switch IP and Switch Port fields for the endpoint. The required data is shown on the endpoint in this view on the portal:
GET /api/endpoint/mac-address/BC-A9-93-08-DB-64
finds the device as expected:
{
"id": 7062,
"mac_address": "bca99308db64",
"description": "AP0141",
"status": "Known",
"randomized_mac": false,
"attributes": {
"EKC-VLAN-ID": "",
"EKC-Device-Type": "AP"
},
"added_at": "Aug 06, 2024 13:34:34 BST",
"updated_at": "Feb 20, 2025 10:43:51 GMT",
"_links": {
"self": {
"href": "https://10.3.3.102/api/endpoint/7062"
}
}
}
But then when I try and filter on the session to find the switch it's connected to with a filter on the mac_address e.g.
GET /api/session?calculate_count=false&offset=0&limit=25&sort=-id&filter={"mac_address":"BC-A9-93-08-DB-64"
}
The JSON Response is an empty item array?
{
"_links": {
"self": {
"href": "https://10.3.3.102/api/session?calculate_count=false&offset=0&limit=25&sort=-id&filter=%7B%22mac_address%22%3A%22BC-A9-93-08-DB-64%22%7D"
},
"first": {
"href": "https://10.3.3.102/api/session?calculate_count=false&offset=0&limit=25&sort=-id&filter=%7B%22mac_address%22%3A%22BC-A9-93-08-DB-64%22%7D"
}
},
"_embedded": {
"items": []
}
}
There doesn't seem to be an endpoint I can see in the API docs that would allow me to simply GET the data using the mac_address, id, callingstationid directly, which is why I am calling /session
Is this possible, I simply want to get the Switch IP and Switch Port as shown in the screenshot. Thank you.