matchAllNamesHandler(_:)

func matchAllNamesHandler(_ req: Request) async throws -> [UserHeader]

GET /api/v3/users/match/allnames/STRING

Retrieves the first 10 User.userSearch values containing the specified substring, returning an array of UserHeader structs.. The intended use for this endpoint is to help isolate a particular user in an auto-complete type scenario, by searching all of the .displayName, .username and .realName profile fields.

Compare to /api/v3/user/match/username/STRING, which searches just .username and returns an array of just strings.

Note

If the search substring contains “unsafe” characters, they must be url encoded. Unicode characters are supported. A substring comprised only of whitespace is disallowed. A substring of “@” or “(@” is explicitly disallowed to prevent single-step username harvesting.

For bulk .userSearch data retrieval, see the ClientController endpoints.

URL Query Parameters:

  • ?favorers=BOOLEAN Show only resulting users that have favorited the requesting user.
  • ?sort=STRING Sort order for results. Currently favorites is supported, which lists users the requester has favorited first, then remaining matches. Both groups stay alphabetical by username. Applied before the 10-result cap. May be combined with favorers (mutual favorites first among people who favorited the requester).

Throws

403 error if the search term is not permitted. 400 error if sort is unrecognized.

Parameters

STRING

in URL path. The search string to use. Must be at least 2 characters long.

Return Value

An array of UserHeader values of all matching users.