Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Did anyone use undelete command to restore the deleted users using Google admin SDK API in Google workspace?

https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/undelete

I want to undelete a user who is recently deleted but the command requires a {userKey}, is string (The immutable id of the user), which I don't know where and how to find:

HTTP request

POST https://admin.googleapis.com/admin/directory/v1/users/{userKey}/undelete

Can anyone help me with the below:

We need to send a request to find this user's immutable id.
Using that ID, we will be able to undelete it.
Add the user to org A.D.
Any other thing which would be required after that.

Thanks in advance for any help!

What I have tried:

I have tried deleting a user, where it only requires "Email address" as identifier. I have tried to get users details, where it only requires "Email address" as identifier.

But when I try to undelete, using "email address" as userkey, it doesn't recognise that user as it is already deleted.
Posted
Updated 14-Sep-23 10:01am
v3
Comments
Dave Kreskowiak 14-Sep-23 11:19am    
Well, it looks like you need the userkey, and ONLY the userkey will work. If you don't have that, you cannot undelete the user. Period.

Can you query for that key. Not that I'm aware of, since the user is already deleted.
SUNNY SINHA 15-Sep-23 3:19am    
Thats the only issue that the user is deleted so when i am querying the user using email show no data, it only works for not deleted users.
How to find out user key of deleted users ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900