<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div data-marker="__QUOTED_TEXT__"><div style=""><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;">Hello,</div><br><div style=""><span style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;">We are currently working on changes to some of the documentation pages. The REST documentation is being re-designed and some examples are being added nevertheless, this is the main docu page for the REST interface <a href="https://docs.evolveum.com/midpoint/reference/support-4.8/interfaces/rest/">https://docs.evolveum.com/midpoint/reference/support-4.8/interfaces/rest/</a> .</span></div><div style=""><span style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><br data-mce-bogus="1"></span></div><div style=""><span style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"> You can access the documentation and examples for the various endpoints we support from here (i.e. </span>https://docs.evolveum.com/midpoint/reference/support-4.8/interfaces/rest/resource-types/users/<span style="font-size: 12pt;">), yet keep in mind that some of the information is still being added.</span></div><div style=""><span style="font-size: 12pt;"><br data-mce-bogus="1"></span></div><div style=""><span style="font-size: 12pt;"> If the information you are looking for is not present in the current version of the pages, you can switch to a pre (midpoint)4.8 version of the documentation (drop-down in the top right corner) or use this link: </span><a href="https://docs.evolveum.com/midpoint/reference/before-4.8/interfaces/rest/" style="font-size: 12pt;">https://docs.evolveum.com/midpoint/reference/before-4.8/interfaces/rest/</a></div><div style=""><br data-mce-bogus="1"></div><div style=""> <!--StartFragment--><div style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 12pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 12pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">--<br></div><div style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 12pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="color: #000000; font-family: arial, helvetica, sans-serif; font-size: 12pt; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Best Regards,<br><br>Matus Macik | Developer and Identity Management Engineer<br>matus.macik@evolveum.com | www.evolveum.com<br>Evolveum</div><!--EndFragment--> </div><hr id="zwchr" style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><b>From: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>To: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>Cc: </b>"AXP" <axp.p@tiscali.it><br><b>Sent: </b>Friday, February 9, 2024 12:58:11 PM<br><b>Subject: </b>[midPoint] Search query from Rest Apis<br></div><br><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><font face="Calibri">Hello,<br>
<br>
In my project I need to retrieve in real time from midpoint the
list of users, I tried by using Rest APIs call.<br>
I searched a lot in the documentation but I found only a not
working example here (Simple Query section):<br>
<a href="https://docs.evolveum.com/midpoint/guides/listing-users-and-their-roles-howto/" rel="nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank">https://docs.evolveum.com/midpoint/guides/listing-users-and-their-roles-howto/</a><br>
<br>
curl.exe --user administrator:5ecr3t -H "Content-Type:
application/xml" -X POST
<a href="http://localhost:8080/midpoint/ws/rest/users/search?options=resolveNames&exclude=metadata&exclude=operationExecution&exclude=credentials/password/value&exclude=assignment/metadata" rel="nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank">"http://localhost:8080/midpoint/ws/rest/users/search?options=resolveNames&exclude=metadata&exclude=operationExecution&exclude=credentials/password/value&exclude=assignment/metadata"</a>
-d @query-all-users.xml<br>
<br>
<?xml version="1.0"?><br>
<q:query
xmlns:q=<a href="http://prism.evolveum.com/xml/ns/public/query-3" rel="nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank">"http://prism.evolveum.com/xml/ns/public/query-3"</a>><br>
<!-- empty query = return all records --><br>
</q:query><br>
<br>
<br>
When I execute the curl command i receive the following error,
there's something wrong in my call?:<br>
<br>
<message>Cannot cast
com.evolveum.midpoint.xml.ns._public.common.common_3.UserType to
com.evolveum.prism.xml.ns._public.query_3.QueryType</message><br>
<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<br>
java.base/java.lang.Class.cast(Class.java:3889)<br>
com.evolveum.midpoint.rest.impl.MidpointAbstractHttpMessageConverter.readInternal(MidpointAbstractHttpMessageConverter.java:81)<br>
org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:198)<br>
<br>
Also I found some other query xml examples on
<a href="https://github.com/Evolveum/midpoint-samples/tree/master/samples/rest" rel="nofollow noopener noreferrer nofollow noopener noreferrer" target="_blank">https://github.com/Evolveum/midpoint-samples/tree/master/samples/rest</a>
but I didn't found a way to execute a successful call<br>
<br>
Is it a not yet implemented feature (or removed in latest
releases)?<br>
Is there a better way to retrieve users programmatically and not
from user interface? <br>
<br>
Thanks,<br>
AXP</font>
<br>_______________________________________________<br>midPoint mailing list<br>midPoint@lists.evolveum.com<br>https://lists.evolveum.com/mailman/listinfo/midpoint</div></div><br></div></div></body></html>