Can I add multiple users to a group in one rest call?
In the API reference, it seems that for every post call to the group membership endpoint can only add one user to the group. Which means I will need make 100 post calls to add 100 users. Is there a way to add multiple users in one call?
-
正式なコメント
Hi Jun!
Today, we only allow for adding one user at a time. You can absolutely do this in a for loop though similar to the below example I just typed out. It is a simple powershell scripts using our CLI. Also, feel free to request this feature on Pulse.
###
### This script assumes you have the CLI installed and configured on your machine.
###
###This command creates a csv of all users in your box env. You could also manually make this.
###run box users --csv >> boxusers.csv in this file's directory ###
###
$UserInput = Import-Csv -path ".\boxusers.csv"
$GroupID = 5132113211
ForEach ($User in $UserInput) {
Write-Host " Adding User ID: $($User."id") to group."
Invoke-Expression "box groups:memberships:add $($User."id") $GroupID --json" | ConvertFrom-Json
}You could also copy user email addresses into the add members window in the admin console.
Thanks,
Alex, Box Developer Advocate
コメントアクション
サインインしてコメントを残してください。
コメント
1件のコメント