[midPoint] Search query from Rest Apis
AXP
axp.p at tiscali.it
Fri Feb 9 15:34:24 CET 2024
Hello Matus,
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).
For everyone who needs to search through rest APIs I paste here an
example, it is needed to use JSON:
curl --user administrator:y0uR_P455woR*d -H "Accept: application/json"
-H "Content-Type: application/json" -X POST
http://localhost:8080/midpoint/ws/rest/users/search --data-binary
@pathToMidpointGit\samples\rest\query-all.json -v
Content of the file:query-all.json
{
"query" : ""
}
Best Regards,
AXP
On 09/02/2024 14:48, Matus Macik wrote:
> Hello,
>
> 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
> https://docs.evolveum.com/midpoint/reference/support-4.8/interfaces/rest/
> .
>
> You can access the documentation and examples for the various
> endpoints we support from here (i.e.
> https://docs.evolveum.com/midpoint/reference/support-4.8/interfaces/rest/resource-types/users/),
> yet keep in mind that some of the information is still being added.
>
> 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:
> https://docs.evolveum.com/midpoint/reference/before-4.8/interfaces/rest/
>
> --
> Best Regards,
>
> Matus Macik | Developer and Identity Management Engineer
> matus.macik at evolveum.com | www.evolveum.com
> Evolveum
> ------------------------------------------------------------------------
> *From: *"midPoint General Discussion" <midpoint at lists.evolveum.com>
> *To: *"midPoint General Discussion" <midpoint at lists.evolveum.com>
> *Cc: *"AXP" <axp.p at tiscali.it>
> *Sent: *Friday, February 9, 2024 12:58:11 PM
> *Subject: *[midPoint] Search query from Rest Apis
>
> 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"
> <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"
> <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
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20240209/c1ebe88a/attachment-0001.htm>
More information about the midPoint
mailing list