Bug 52806 - [Kelvin API] Allow mail address as identifier for resource "users"
[Kelvin API] Allow mail address as identifier for resource "users"
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: HTTP-API (Kelvin)
UCS@school 4.4
Other Windows NT
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-16 22:13 CET by Michael Grandjean
Modified: 2021-05-25 13:30 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Grandjean univentionstaff 2021-02-16 22:13:40 CET
Currently, the resource "users" is defined via the username:

https://<your-fqdn-here>/ucsschool/kelvin/v1/classes/users/{username}

It should also be possible to use:

https://<your-fqdn-here>/ucsschool/kelvin/v1/classes/users/{mailPrimaryAddress}

Scenario: The source system behind the API client does not know the usernames, that are used in UCS@school. However, it does know about the email address associated with each user.

I am aware, that we could use a GET command with searchfilter 'mailPrimaryAddress=yourname@maildomain.org', retrieve the username and then proceed with an update command (PUT/DELETE/PATCH) on that username, but with several thousand to tenthousand expected changes per day, the shortcut above would be very handy.
Comment 1 Michael Grandjean univentionstaff 2021-02-16 22:14:52 CET
Mixed up the URLs ... should be:

https://<your-fqdn-here>/ucsschool/kelvin/v1/users/{username}

and

https://<your-fqdn-here>/ucsschool/kelvin/v1/users/{mailPrimaryAddress}
Comment 2 Daniel Tröder univentionstaff 2021-02-17 08:00:30 CET
Using the email address as primary key is common in admin REST APIs like for example the one from Google. It would be possible for us to implement this without an API change, as the syntax for usernames forbids an '@' in it.
The code could work like this:

if '@' in 'name'
then get user by mailPrimaryAddress
else use old behavior (get by username).