Okta_Integration | 2023-03-13 15:36:01 UTC | #1
Hello There, I am building an automate process on another platform (Okta) that when a user leaves the company, the process will issue API calls to delete this user's soft phone and then his/her Genesys user account. I can find user ID by searching user based on email, but how do I link a user ID to his/her phone to retrieve phone id in order to delete the phone via API call? I don't see there is any direct link btw user object and phone object. Anybody had similar situation and could provide some guidance? thank you in advance!
Zino_Onokpise | 2023-03-13 16:29:28 UTC | #2
Hi,
You can get a user's phone number with their user ID using this api: https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-users--userId-
Okta_Integration | 2023-03-13 18:04:37 UTC | #3
@Zino_Onokpise , thanks for infor. Which field is for phone number or ID from your screen shot? is that phone number unique to the user?
Zino_Onokpise | 2023-03-13 19:19:40 UTC | #4
Yes, that screenshot is a schema from a 200 response on that api link sent earlier, you can access schema on api responses by clicking the api responses drop down on each api tile
Okta_Integration | 2023-03-13 21:21:47 UTC | #5
but I don't see any field on user object can reference phone object, or vice versa... in other word, i cannot retrieve associated phone object based on the user object, can I?
tim.smith | 2023-03-13 21:43:02 UTC | #6
Okta_Integration, post:1, topic:18860
how do I link a user ID to his/her phone to retrieve phone id in order to delete the phone via API call?
This is something you'll have to manage outside of Genesys Cloud as this is not a concept in the platform. A user can use any station they're permitted to by using PUT /api/v2/users/{userId}/station/associatedstation/{stationId}. A user only "has a phone" when they're actively using it.
If you want to create the concept of a 1:1 relationship between a user and a phone, you need to come up with a way to create that linkage outside of Genesys Cloud. That could be something as simple as a naming convention or could be somewhere that you maintain a list of userID/stationID pairs for a direct lookup.
Note that a user can have a default station (User > station.defaultStation), but that is not required and can be updated after the user is created. That creates the potential that deleting a user and their set default station could delete a station that is not the same phone they were configured with when they were created.
Okta_Integration | 2023-03-14 13:02:15 UTC | #7
@tim.smith , thanks for explanation. The termination document I got from the user who performs manual steps now is to delete user's soft phone and user account when user leaves company. I am not familiar with Genesys at all, but from data pulled on user, station, lines, phone objects, i found below linkage which I am not sure if I am on right path:
- retrieve userid: user search based on user email, one API call;
- retrieve station id based on user.userid = station.webRtcUserId:
- retrieve phone id based on phone.lines.id = station.id
- delete phone first via API: /api/v2/telephony/providers/edges/phones/{id}
- then delete user via API: /api/v2/users/{id}
Does above look right?
thank you so much!
John_Carnell | 2023-03-27 17:10:42 UTC | #8
This post was migrated from the old Developer Forum.
ref: 18860