When using the API on CMX 10.4 for requesting historical clients, I am using the following:-
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?
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.
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.
From Cisco CMX Configuration Guide, Release 10.4.
Let us know if this was the issue.
|Step 1||Log in to Cisco Cisco Mobile Connected Experiences (Cisco CMX).|
|Step 2||Choose System > Dashboard. The System at a Glance window is displayed.|
|Step 3||Click Settings at the top-right corner of the window. The SETTINGS window is displayed.|
By default, the Tracking Parameters tab is displayed.
|Step 4||In the Elements column, check the check box of each device that you want to select for tracking.Figure 1. Tracking Parameters|
Only the elements selected here will be tracked by the network location service and will appear on the Activity Map window.
The following elements are available for tracking:
|Step 5||Click Save.|
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>
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.
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 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.
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.
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.
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.
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