<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <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 class="moz-txt-link-freetext" href="https://docs.evolveum.com/midpoint/guides/listing-users-and-their-roles-howto/">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 class="moz-txt-link-rfc2396E" href="http://localhost:8080/midpoint/ws/rest/users/search?options=resolveNames&exclude=metadata&exclude=operationExecution&exclude=credentials/password/value&exclude=assignment/metadata">"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 class="moz-txt-link-rfc2396E" href="http://prism.evolveum.com/xml/ns/public/query-3">"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 class="moz-txt-link-freetext" href="https://github.com/Evolveum/midpoint-samples/tree/master/samples/rest">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>
  </body>
</html>