Jamf Blog
September 29, 2022 by Hannah Hamilton

Creation of Google Classes from Jamf Pro Classes through API and GAM

In this JNUC presentation, Rob Brown, director of technology at Foxcroft Academy, discusses the script he wrote in Perl and Bash. His script creates Google Classroom classes from existing Jamf Pro classes via the Jamf Pro API and GAM tool.

At the cusp of COVID-19, Rob Brown needed to respond to Foxcroft Academy’s imminent shift into remote learning. As a Google Workspace Institution and 1-to-1 iPad high school, they had the tools for remote learning but no standard method. They decided to adopt Google Classroom across the board and use the information already in their Jamf implementation to populate their Google classes. This new demand brought a set of questions-- how can we automate making a class on Google Classroom? How do we get the data from one system to another? Brown decided to automate the process with tools he already had in his toolbox: the Google Apps Manager (GAM) tool, Google Workspace, and the Jamf API.

Tools for automation

Brown was already using the GAM tool, a Google Workspace Integration, for managing student accounts and the Jamf API to assign static user groups. The GAM tool, according to its GitHub page, is a “command line tool for Google Workplace admins to manage domain and user settings quickly and easily.” Brown discovered that he could use Perl to create his automation with the addition of a few modules:

  • LWP: Adds core functionality for web programming
  • HTTP: For querying the Jamf Pro server to get back XML
  • XML: To parse and work with XML

Brown installed this directly on their on-site Jamf Pro implementation located on a Linux server. Because of his familiarity with Perl, Brown chose it to write his initial script, then proceeded to rewrite it in Bash for further flexibility. Bash required the addition of one module, xmlstarlet, which parses XML.

Assumptions and workflow

The scripts rely on a number of assumptions:

  • Jamf classes use student groups
  • Common usernames in Jamf and Google Workspace
  • Common classnames between groups and classes in Jamf and Google Workspace
  • Single Jamf implementation
  • Active Google account

Brown discusses these assumptions and describes the scripts’ workflow. To summarize, the scripts:

  1. Use the Jamf API to get a list of the classes
  2. Loop through each class to verify it exists in Google Workspace
  3. Either update the teacher list of classes or create the class
  4. Update the list of students

The scripts then use the GAM tool to update the Google Classroom with the new list, leaving you with a list of updated teachers and students. Brown discusses the specifics for the Perl and Bash scripts in his presentation for those familiar with scripting basics.

Limitations and future features

Brown proceeds to list a few limitations of the scripts:

  • GAM tool speed: The tool can take around 40 minutes to make changes for ~300 classes.
  • Delayed changes for class owner: The owner does not always change in the Google Workspace backend, requiring the script to be run twice.
  • Limited to one site: The scripts was built for one Jamf implementation.

These are then followed by planned future features:

  • Multiple site support
  • Caching on the Jamf Pro server
  • Uses updated Jamf Pro API
Photo of Hannah Hamilton
Hannah Hamilton
Hannah Hamilton, Copywriter.
Subscribe to the Jamf Blog

Have market trends, Apple updates and Jamf news delivered directly to your inbox.

To learn more about how we collect, use, disclose, transfer, and store your information, please visit our Privacy Policy.