Hi there,
Is there any way to assign a user to a group using the user’s Okta username using the endpoint
/api/v1/groups/{groupId}/users/{userId}?
According to the documents Assign a user to a group, userId is ID of an existing Okta user.
I can use the ID like 00ub0oNGTSWTBKOLGLNR to assign a user to group, but I can’t use the encoded username to assign the user to a group.
Is this expected? Or did I use the username in a wrong way?
Thanks!
Yes, that is expected. Only the Users endpoint supports retrieving a user based on their login shortname.
So in your use case, you could send the login shortname to Users to get the User ID, https://subdomain.okta.com/api/v1/users/{{shortname}}
and then use that ID to assign them to the target group
1 Like
thanks for the answer!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.