Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do we set the role of a user? #30

Closed
I-FGSD opened this issue Mar 10, 2021 · 7 comments
Closed

How do we set the role of a user? #30

I-FGSD opened this issue Mar 10, 2021 · 7 comments

Comments

@I-FGSD
Copy link
Contributor

I-FGSD commented Mar 10, 2021

The API seems to have a way to update the role (https://marketplace.zoom.us/docs/api-reference/zoom-api/roles/updaterole) but I can't find the corresponding PSZoom command to update it. Is there a way to do this with PSZoom?

Thank you.

@JosephMcEvoy
Copy link
Owner

You can try and use PSZoom/Public/Utils/Invoke-ZoomRestMethod.ps1. This hasn't bee added to PowerShell Gallery, yet. Ideally you would open up a pull request and add the functionality.

@I-FGSD
Copy link
Contributor Author

I-FGSD commented Mar 10, 2021

I see... I was actually meaning to ask how to update a user's role (https://marketplace.zoom.us/docs/api-reference/zoom-api/roles/addrolemembers), but I imagine it's the same answer.

@I-FGSD
Copy link
Contributor Author

I-FGSD commented Mar 10, 2021

Woohoo.. it's a steep learning curve, but thank you for making it less steep!

@I-FGSD I-FGSD closed this as completed Mar 10, 2021
@I-FGSD
Copy link
Contributor Author

I-FGSD commented Mar 10, 2021

Actually... one quick question... I got it to list the roles using this:
$request = [System.UriBuilder]"https://api.zoom.us/v2/roles/{roleId}/members"
Invoke-ZoomRestMethod -Uri $request.Uri -ApiKey $($ZoomApiKey) -ApiSecret $($ZoomApiSecret) -Method GET

So building on that I can set the roles using this I imagine, but I'm not sure how to add the userID to this so that it updates a specific user's role?

$request = [System.UriBuilder]"https://api.zoom.us/v2/roles/RoleIDGoesHere/members"
Invoke-ZoomRestMethod -Uri $request.Uri -ApiKey $($ZoomApiKey) -ApiSecret $($ZoomApiSecret) -Method POST

@I-FGSD I-FGSD reopened this Mar 10, 2021
@I-FGSD
Copy link
Contributor Author

I-FGSD commented Mar 10, 2021

Ah, figured it out... I added -Body '{"members":[{"id":"MemberIDHere"}]}' and it worked!! Thanks so much for creating this!

@I-FGSD I-FGSD closed this as completed Mar 10, 2021
@JosephMcEvoy
Copy link
Owner

Something like this (code not verified):

$roleid = 'admin'
$members = @(@{id = 'izirdum'},@{id = 'izirdumsfriend'})
$request = [System.UriBuilder]"https://api.zoom.us/v2/roles/$($roleid)/members"
$requestBody = @{
members = $members
}

$requestBody = $requestBody | ConvertTo-Json
 Invoke-ZoomRestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method POST -ApiKey $ApiKey -ApiSecret $ApiSecret

@JosephMcEvoy
Copy link
Owner

Ah, figured it out... I added -Body '{"members":[{"id":"MemberIDHere"}]}' and it worked!! Thanks so much for creating this!

Nice work. You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants