cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1160
Views
0
Helpful
1
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: GEERT DEWINTER on 15-10-2012 07:47:14 AM
Hi,
CUC Version 7
When I try "https://xx.xx.xx.xx:8443/vmrest/users?rowsperpage=0" as mentioned in the wiki, I always get the following result  :
<code><ErrorDetails><errors><code>DATA_EXCEPTION</code><message>
query
returns more than the maximum allowable results, use rowsperpage query
parameter to limit results:
max=2000</message></errors></ErrorDetails></code>
 
Can anyone tell me how to get a number and not a list of all the users? 
 
When
using the "pageNumber=0" option
<code><ErrorDetails><errors><code>DATA_EXCEPTION</code><message>A
syntax error has
occurred.</message></errors></ErrorDetails></code>
 
Thanks,
Best Regards,
Geert

Subject: RE: CUPI and rowsperpage=0 / pageNumber=0
Replied by: Anil Singh on 15-10-2012 08:36:50 AM
Hi Geert,
Correct API that need to be called are:
1) https://XX.XX.XX.XX:8443/vmrest/users?rowsPerPage=100&pageNumber=0
it will return total count of users.
2) https://XX.XX.XX.XX:8443/vmrest/users?rowsPerPage=100&pageNumber=1
it will return users detail and you can here change page number to traverse.
 
Thanks
Anil Singh
 

Subject: RE: CUPI and rowsperpage=0 / pageNumber=0
Replied by: GEERT DEWINTER on 15-10-2012 09:19:22 AM
thanks Anil,
I tried your first query and it gives me => syntax error
When putting all in lower case it returns => query returns more than the maximum allowable results, use rowsperpage query parameter to limit results: max=2000
Any ideas?
Thanks,
Geert
 

Subject: RE: CUPI and rowsperpage=0 / pageNumber=0
Replied by: Anil Singh on 15-10-2012 10:49:57 AM
Hi Geert,
I have tested on CUC verison 8.5 & above, and everywhere its working fine.
You are using CUC version 7, so i need to check on that version. so can you share logs and URL which you calling.
First enable micro traces of VMREST .
Log path: /var/opt/cisco/connection/log/diag_Tomcat
Thanks
Anil Singh
 

Subject: RE: CUPI and rowsperpage=0 / pageNumber=0
Replied by: Anil Singh on 15-10-2012 11:01:17 AM
Geert,
One more thing..
Have you tried with 2nd url.
https://XX.XX.XX.XX:8443/vmrest/users?rowsPerPage=100&pageNumber=1

Subject: RE: CUPI and rowsperpage=0 / pageNumber=0
Replied by: GEERT DEWINTER on 16-10-2012 11:10:14 AM
Hi Anil,
The second command seems to work. I get a list of users.
I activated the trace for VMREST and got the message "A syntax error has occurred" again.
The trace looks like :
12/30/2011 11:44:20.292 |8404,,,-1,-1,Logging initialized for Tomcat (Cuca CuService CiscoPCA PCAUnifiedCM PCAMeetingPlace UnityAssistant UnityInbox UnityPCTR AudioStore MediaMasterControl MediaMasterWeb MediaMasterUMS TranscodeWeb TRAP BulkAdministrationTool RSS Cuals MessageEventService VMWS VMREST)|
10/15/2012 14:48:22.642 |3054,,,VMREST,0,ERROR [http-8443-9] com.cisco.connection.rest.helper.Utilities  - query returns more than the maximum allowable results, use rowsperpage query parameter to limit results: max=2000|
10/15/2012 14:48:30.326 |3054,,,VMREST,0,ERROR [http-8443-9] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - unable to get a list: user|
10/15/2012 14:48:30.326 |3054,,,VMREST,0,ERROR [http-8443-9] com.cisco.connection.rest.helper.Utilities  - A syntax error has occurred.|
10/15/2012 16:16:09.400 |3054,,,VMREST,0,ERROR [http-8443-9] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - unable to get a list: user|
10/15/2012 16:16:09.400 |3054,,,VMREST,0,ERROR [http-8443-9] com.cisco.connection.rest.helper.Utilities  - A syntax error has occurred.|
10/16/2012 17:30:50.521 |11609,,,Cuca,0,com.cisco.unity.logging.log4j.ConfigLoader: update called for diag grid VMREST old flags: 1, new flags: 15.|
10/16/2012 17:30:50.700 |11609,,,Cuca,0,com.cisco.unity.logging.log4j.ConfigLoader: VMREST: setting category 1 to true.|
10/16/2012 17:30:50.700 |11609,,,Cuca,0,com.cisco.unity.logging.log4j.ConfigLoader: VMREST: setting category 2 to true.|
10/16/2012 17:30:50.700 |11609,,,Cuca,0,com.cisco.unity.logging.log4j.ConfigLoader: VMREST: setting category 3 to true.|
10/16/2012 17:31:41.727 |28416,,,VMREST,3,DEBUG [http-8443-10] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - setting rows per page: 100|
10/16/2012 17:31:41.727 |28416,,,VMREST,3,DEBUG [http-8443-10] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - setting page number: 0|
10/16/2012 17:31:41.727 |28416,,,VMREST,3,DEBUG [http-8443-10] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - query: null|
10/16/2012 17:31:41.727 |28416,,,VMREST,3,DEBUG [http-8443-10] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - parse sort: null|
10/16/2012 17:31:41.782 |28416,,,VMREST,3,DEBUG [http-8443-10] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - created authentication information: username=xxxxxxxxx|
10/16/2012 17:31:41.836 |28416,,,VMREST,3,ERROR [http-8443-10] com.cisco.connection.rest.impl.GeneratedUserRestImpl  - unable to get a list: user|
10/16/2012 17:31:41.846 |28416,,,VMREST,3,ERROR [http-8443-10] com.cisco.connection.rest.helper.Utilities  - A syntax error has occurred.|
Thanks a lot in advance for your help.
Best regards,
Geert

Subject: RE: CUPI and rowsperpage=0 / pageNumber=0
Replied by: Anil Singh on 16-10-2012 12:25:10 PM
Hi Geert,

That’s good you are able to get list of users using 2nd API.
I have checked in code for first API and I found that there is code missing to get total number of users when pagenumber=0 or rowsperpage=0.
But this problem has been fixed in 8.5 & above version, its not in CUC 7.
 
Thanks
Anil Singh

Subject: RE: CUPI and rowsperpage=0 / pageNumber=0
Replied by: GEERT DEWINTER on 17-10-2012 02:38:04 AM
Hi Anil,
I will have to ask for an upgrade then. Thanks a lot!!
Best regards,
Geert
 
Comments
grk0519
Level 1
Level 1

below code worked for me.

#Powershell script to export users from CUC unity connection API

"UserYourApiPassword" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File C:\apiuserpw.txt
$cucUsername = "ApiUserName"
$cucpwd = Get-Content C:\apiuserpw.txt
$securepwd = $cucpwd | ConvertTo-SecureString
$cucCred = new-object -typename System.Management.Automation.PSCredential -ArgumentList ($cucUsername,$securepwd)

#add dotnet cert obj to avoid the cert errors

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

$urlresponse = Invoke-WebRequest -Credential $cucCred -Uri "https://xx.xx.xx.xx/vmrest/users?rowsPerPage=1" -UseBasicParsing

if($urlresponse.StatusCode -eq 200){
  Write-Host "Connected"
  $x = 0
  $userdata = @()
 do{
     $x++
     Write-Host "page Number $x"
     $userurl = Invoke-RestMethod -Credential $cucCred -Uri "https://xx.xx.xx.xx/vmrest/users?rowsPerPage=100&pageNumber=$x"

    $userdata += $userurl.Users.User

    }while($userurl.Users.User.Length -eq 100)

}
else{Write-Host "Unable to Connect" }
#export Data to csv File
$userdata |Export-Csv cucuserdata.csv -NoTypeInformation

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links