Basic User Search

Last modified 04 Jul 2025 10:59 +02:00

Write a Groovy script User.search.groovy which handles search of the object class User.

The Groovy script should look like:

objectClass("User") {
    search {
        endpoint("/users/search") {
            objectExtractor {
                return response.body.get("users")
            }
            pagingSupport {
                request.queryParameter("size", paging.pageSize)
                       .queryParameter("offset", paging.pageOffset)
            }
        }
    }
}

Where:

  • endpoint - method takes an search / list endpoint as an argument.

  • objectExtractor - optional, it is used to extract a list of objects from response.body in java org.json.JSONObject format.

  • paggingSupport - optional, allows to specify paging information in the request

  • Paging information is available in paging object with

  • pageSize representing size of requested page

  • pageOffset representing size number of page to be returned (first page has offset 1)

  • request is object used to customize request. You can use queryParamater(name, value) to add HTTP query parameters to request.

Was this page helpful?
YES NO
Thanks for your feedback