Populating Blackboard groups using REST

Discussion created by mdeeprose on Jul 21, 2019
Latest reply on Jul 31, 2019 by md0049252

I have a few requests for automatically adding users to groups on Blackboard courses. Examples are:


1) Faculties are setting up “hub” courses on Blackboard to share resources with students in a faculty. The are using Blackboard rather than an intranet because “Blackboard is where the students go”. We have five faculties and each will have 5 to 10 departments. The staff setting up the “hub” courses want to have Blackboard groups for staff/students for each department, so they can use adaptive release rules, and group email. It’s onerous to maintain these group lists manually.
2) A module is taught in many deliveries, but only one course is used on Blackboard. The instructor wants groups automatically populated with students for each delivery, so they can use adaptive release, grade centre smart views, and group email. It’s onerous to maintain these group lists manually.

Following on from Dom's post at  I have been experimenting with REST and having followed the brilliant  tutorial and the  documentation I have got proof of concept CURL to add and remove users to groups on our 2018 Q4 CU6 system:


Add user to a group:
curl -X PUT -H "Authorization: Bearer AccessTokenGoesHere" https://blackboard... /learn/api/public/v1/courses/courseId:XXX/groups/externalId:YYY/users/userName:ZZZ

# This returns {"userId":"_1010101_1"}

To remove a user from a group:

curl -X DELETE -H "Authorization: Bearer AccessTokenGoesHere" https://blackboard.../learn/api/public/v1/courses/courseId:XXX/groups/externalId:YYY/users/userName:ZZZ

# This returns no response.

Also noted that I can add -i to get the http responses or -v to get verbose responses.


These are simple and don’t require any JSON. Since I already have the datasets with the required information for use with SIS integration on our Blackboard tasks node running Linux I plan to continue using bash tools like cat, awk, grep, diff, comm, that I use for SIS, to update and remove group users using REST.


My rough plan is

1) Get a list of the users to create the list of users to be added.
2) Do a manual upload through the GUI to get the users into the groups (some groups could have 1000 or more members)
3) Get the group externalIds for use with the CURL commands later.
4) Each day make a list of the full group membership list from central data (e.g. all users in department X) and compare it with the full set from yesterday and make a list of usernames to be added or removed (people new in the list, or no longer in the list) Similar to set up followed for “complete refresh is evil SIS tutorial”.
5) Generate a CURL command to add each user who is new, and vice versa to remove old users
6) Write that into a script and run it on a crontab.


Before I start playing with this I wanted to check if anyone can share any experiences with:

- How best to handle keeping the access token up to date using bash tools only?
- After sending a curl command to add or delete a user should the response be captured and logged? Should I check that it’s the expected response before moving onto the next curl command?
- Should there be a pause between curl commands? E.g. five seconds? Not sure if sending say 100 curls one after another to Blackboard could hit performance?
- Any other considerations?


I plan to start experimenting with this over the next couple of weeks and will report back on my progress.