Hi Jerome,
That makes perfect sense.
However, I still think there is a bit of an issue with regard to the SDK function itself - though a small and possibly immaterial issue :-).
The function "getUser(userId, opts)" has a Return type of "User", which is a single object.
The function "getUsers(opts)" has a Return type of "UserEntityListing", which is an array of objects.
If you call "getUser(userId, opts)" with "userId" = "", it will return a "UserEntityListing".
This contradicts the documentation and has the potential to break code.
Surely the function should return an error if a valid (or at least non-empty) "userId" is not provided.
Cheers
Andrew Watson
------------------------------
Andrew Watson
Architect
------------------------------
Original Message:
Sent: 06-11-2025 14:39
From: Jerome Saint-Marc
Subject: Possible bug in the Javascript SDK
Hello,
It is most likely because using an empty userId (empty string) will result in this url: GET /api/v2/users/
Which is the endpoint for user listing (i.e. getUsers).
The SDK only checks if userId is not null and not undefined.
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
------------------------------