Skip to content

Latest commit

 

History

History
110 lines (89 loc) · 4.04 KB

File metadata and controls

110 lines (89 loc) · 4.04 KB

Search API

Search Profiles and Groups

GET /auth/v1/profile

Search for EDI profiles and groups based on a search string.

  • The search is case-insensitive and supports partial matches
  • The search string must be at least 3 characters long
  • Matches always start at the beginning of each field
  • Only a limited number of results are returned; refine the search string if the expected match is not found
  • For profiles, the search string is matched against:
    • The full common name (CN)
    • The second part of the common name (family name in Western cultures)
    • Email address
    • Profile EDI-ID (EDI- prefix is optional)
  • For groups, the search string is matched against:
    • Group name
    • Group description
    • Group EDI-ID (EDI- prefix is optional)

Required permission: Caller must be authenticated.

Parameters

Parameter In Required Description
edi-token Cookie Yes See Parameters
s Query string Yes Search string (minimum 3 characters)
profiles Query string No Include profiles in results (default: true)
groups Query string No Include groups in results (default: true)

Response

Status Description
200 OK Search completed; response contains matching profiles and/or groups
401 Unauthorized See Parameters
403 Forbidden Caller is not authenticated
404 Not Found No matches found

200 OK response body:

Field Description
method "searchPrincipals"
msg "Profiles and/or groups searched successfully"
profiles List of matching profile objects (if profiles=true)
groups List of matching group objects (if groups=true)

Profile object fields:

Field Description
edi_id EDI-ID of the profile
common_name Common name of the user
email Email address
avatar_url URL of the user's avatar

Group object fields:

Field Description
edi_id EDI-ID of the group
name Group name
description Group description

Example

Request:

curl "https://auth.edirepository.org/auth/v1/profile?s=John&profiles=true&groups=true" \
  -H "Cookie: edi-token=$(<~/Downloads/token-EDI-<my-token>.jwt)"

Response 200 OK:

{
  "method": "searchPrincipals",
  "msg": "Profiles and/or groups searched successfully",
  "profiles": [
    {
      "edi_id": "EDI-147dd745c653451d9ef588aeb1d6a188",
      "common_name": "John Smith",
      "email": "john@smith.com",
      "avatar_url": "https://auth.edirepository.org/auth/ui/api/avatar/gen/JS"
    }
  ],
  "groups": [
    {
      "edi_id": "EDI-abcdef1234567890abcdef1234567890",
      "name": "Researchers",
      "description": "Group for all researchers"
    }
  ]
}