Hello,
When using the API on CMX 10.4 for requesting historical clients, I am using the following:-
<domain>/api/location/v1/historylite/byusername/<username>?date=2018/01/01&allMacs=true
The return result is "CMX: System error".
I can pull the current clients no problems, but I always get the system error on history requests.
Any ideas on why?
Thanks!
Hi Trevor,
Using DevNet Sandbox running CMX 10.4.1-2 with credentials learning/learning.
returns 200 ok.
The url and parameters look good, need to check the authorization is correct.
Please, provide more information such as CMX version, and methods of calling API.
Thanks.
The authorization is correct since calling active clients works fine ie: /api/location/v3/clients?username=<username>
I am using CMX 10.4.1-2 and testing via the API reference page on the server. I've also tried using curl remotely to pull the results.
After checking some other "Location" API methods such as interferers and rogue aps, they also do not work and report "System error". Seems the only API method working is the active clients.
Hi Trevor,
From Cisco CMX Configuration Guide, Release 10.4.
Let us know if this was the issue.
Thanks,
Matt
The CMX 10.4 have a new APIv3 -- New API version 3 for Active Clients
That's correct and that is the version I am using. The Active Clients works fine, the Clients History API does not work.
I did check the "Tracking Parameters" and the only 3 unchecked were the Rogue APs, Rogue Clients and BLE.
Okay this is interesting. I decided to do some investigation into the logs and in the location/error.log discovered this:-
2018-02-12T16:56:56,298 [qtp1591409408-508] ERROR com.cisco.mse.configuration.aaa.dao.UserDao - Failed to find user:<cmx api username>
2018-02-12T16:56:56,298 [qtp1591409408-508] ERROR com.cisco.mse.aaa.security.realms.CMXBasicAuthRealm - There was a error while authenticating user [<cmx api username>]
This appears when I try to do a "This API returns a compact history of client by date and username" via the API reference page. The API user and password is entered at the top right of the page.
I just tried the same request using curl remotely and received the same error.
Edit: I just reset the API username using this:- cmxos apiserver user
same result... failed to find user:<cmx api username>
Hi Trevor,
Let me open a bug report for CMX. I may need additional info when the engineering team starts looking at it. I have enough info to open the ticket.
Thanks.
Trevor,
Ticket opened - CSCvh95839(CSC.embu,new,matfarre)CMX 10.4 historylite system error.
Please, try changing or adding your username/password from the Manage tab under Users and see if that resolves anything.
Thanks.
Hey Matthew,
Thanks for opening a ticket. I just tried using a cmx login user account for the API and the results for historylite worked. I also tried interferers and rogue APs using the login account instead of the API user and these worked as well.
Hi Trevor,
That is good news. I'll update and close the ticket.
Thanks.
Hey Matthew,
Does that mean these type of requests are authorized by a CMX user account and not a CMX API services account?
Sounds like I should create the same API account on the CMX server side to allow either API active client queries or history queries.
Hi,
I have asked engineering, regarding system credentials and ui/api credentials, for a good description, and use, of each credential used with CMX? e.g., cmxadmin, root, ui, etc. I will follow up soon.
Matt
Hi Trevor,
Here is something that we didn't consider as the problem several weeks ago. New for CMX 10.4 is a new API username and password, and is only required for the new Active V3 Clients API resource. Here is the comment from Cisco CMX 10.4 REST API Guide.
Thanks.
/api/location/v3/clients/count
/api/location/v3/clients
The API Username is set using the cmxos apiserver user command. This will change the username and password just for the Active V3 Clients API.
With the newer version of CMX, now with 10.6 released, will the Client History API be updated to V3 API? Or will the v1 API's ever be switched to use the API server credentials?
I ask because when creating scripts to use the various CMX API I do not want to have to use the CMX GUI credentials for the v1 API's and then use the API server credentials for the v3 API's