<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<font face="Calibri">Hello Matus,<br>
<br>
Thanks for your quick response, I definitively found a way from
your links (unfortunately was a bit confusing the reachability of
the new version of the documentation from portal official links).<br>
<br>
For everyone who needs to search through rest APIs I paste here an
example, it is needed to use JSON:<br>
<br>
curl --user administrator:y0uR_P455woR*d -H "Accept:
application/json" -H "Content-Type: application/json" -X POST
<a class="moz-txt-link-freetext" href="http://localhost:8080/midpoint/ws/rest/users/search">http://localhost:8080/midpoint/ws/rest/users/search</a> --data-binary
@pathToMidpointGit\samples\rest\query-all.json -v<br>
<br>
Content of the file:</font><font face="Calibri"><font
face="Calibri"> query-all.json<br>
</font>{<br>
"query" : ""<br>
}<br>
</font><br>
Best Regards,<br>
AXP<br>
<br>
<br>
<div class="moz-cite-prefix">On 09/02/2024 14:48, Matus Macik wrote:<br>
</div>
<blockquote type="cite"
cite="mid:959133230.76840.1707486536293.JavaMail.zimbra@evolveum.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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/"
moz-do-not-send="true" class="moz-txt-link-freetext">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><a class="moz-txt-link-freetext" href="https://docs.evolveum.com/midpoint/reference/support-4.8/interfaces/rest/resource-types/users/">https://docs.evolveum.com/midpoint/reference/support-4.8/interfaces/rest/resource-types/users/</a><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;" moz-do-not-send="true"
class="moz-txt-link-freetext">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>
<a class="moz-txt-link-abbreviated" href="mailto:matus.macik@evolveum.com">matus.macik@evolveum.com</a> | <a class="moz-txt-link-abbreviated" href="http://www.evolveum.com">www.evolveum.com</a><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" <a class="moz-txt-link-rfc2396E" href="mailto:midpoint@lists.evolveum.com"><midpoint@lists.evolveum.com></a><br>
<b>To: </b>"midPoint General Discussion"
<a class="moz-txt-link-rfc2396E" href="mailto:midpoint@lists.evolveum.com"><midpoint@lists.evolveum.com></a><br>
<b>Cc: </b>"AXP" <a class="moz-txt-link-rfc2396E" href="mailto:axp.p@tiscali.it"><axp.p@tiscali.it></a><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" moz-do-not-send="true"
class="moz-txt-link-freetext">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" moz-do-not-send="true">"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" moz-do-not-send="true">"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" moz-do-not-send="true"
class="moz-txt-link-freetext">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>
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br>
<a class="moz-txt-link-freetext" href="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a></div>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>