Implement basic user search

Last modified 04 May 2026 13:29 +02:00

How to implement basic user search in a SCIMREST connector using a Groovy script, including endpoint configuration, object extraction, and paging support.

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.

GET /users/search

Search for users

Parameters

Name Type Description

q

string (query)

keyword

uid

integer($int64) (query)

ID of the user to search for

page

integer (query)

page number of results to return (1-based)

limit

integer (query)

page size of results

Responses

  • 200 - SearchResults of a successful search

Example value:

{
  "data": [
    {
      "active": true,
      "avatar_url": "string",
      "created": "2025-05-05T12:10:33.653Z",
      "description": "string",
      "email": "user@example.com",
      "followers_count": 0,
      "following_count": 0,
      "full_name": "string",
      "html_url": "string",
      "id": 0,
      "is_admin": true,
      "language": "string",
      "last_login": "2025-05-05T12:10:33.653Z",
      "location": "string",
      "login": "string",
      "login_name": "empty",
      "prohibit_login": true,
      "pronouns": "string",
      "restricted": true,
      "source_id": 0,
      "starred_repos_count": 0,
      "visibility": "string",
      "website": "string"
    }
  ],
  "ok": true
}
Was this page helpful?
YES NO
Thanks for your feedback