[midPoint] Search query from Rest Apis

AXP axp.p at tiscali.it
Fri Feb 9 12:58:11 CET 2024


Hello,

In my project I need to retrieve in real time from midpoint the list of 
users, I tried by using Rest APIs call.
I searched a lot in the documentation but I found only a not working 
example here (Simple Query section):
https://docs.evolveum.com/midpoint/guides/listing-users-and-their-roles-howto/

curl.exe --user administrator:5ecr3t -H "Content-Type: application/xml" 
-X POST 
"http://localhost:8080/midpoint/ws/rest/users/search?options=resolveNames&exclude=metadata&exclude=operationExecution&exclude=credentials/password/value&exclude=assignment/metadata" 
-d @query-all-users.xml

<?xml version="1.0"?>
<q:query xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3">
     <!-- empty query = return all records -->
</q:query>


When I execute the curl command i receive the following error, there's 
something wrong in my call?:

<message>Cannot cast 
com.evolveum.midpoint.xml.ns._public.common.common_3.UserType to 
com.evolveum.prism.xml.ns._public.query_3.QueryType</message>
<details>java.lang.ClassCastException: Cannot cast 
com.evolveum.midpoint.xml.ns._public.common.common_3.UserType to 
com.evolveum.prism.xml.ns._public.query_3.QueryType
java.base/java.lang.Class.cast(Class.java:3889)
com.evolveum.midpoint.rest.impl.MidpointAbstractHttpMessageConverter.readInternal(MidpointAbstractHttpMessageConverter.java:81)
org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:198)

Also I found some other query xml examples on 
https://github.com/Evolveum/midpoint-samples/tree/master/samples/rest 
but I didn't found a way to execute a successful call

Is it a not yet implemented feature (or removed in latest releases)?
Is there a better way to retrieve users programmatically and not from 
user interface?

Thanks,
AXP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20240209/cea4f873/attachment.htm>


More information about the midPoint mailing list