Zoom LTI Pro Bulk Import API usage

Got it working in PowerShell. If it’s helpful to anyone:

$lti_key = 'from marketplace LTI Pro app'
$lti_secret = 'from marketplace LTI Pro app'

# Based on the super helpful algorithm script here: https://www.reddit.com/r/PowerShell/comments/8bc3rb
$exp = [int][double]::parse((Get-Date -Date $((Get-Date).ToUniversalTime()) -UFormat %s)) # Grab Unix Epoch Timestamp
$ToBeSigned = 'key=' + $lti_key + '&timestamp=' + $exp +'000'
$SigningAlgorithm = New-Object System.Security.Cryptography.HMACSHA1
$SigningAlgorithm.Key = [System.Text.Encoding]::UTF8.GetBytes($lti_secret)
$Signature = [Convert]::ToBase64String($SigningAlgorithm.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($ToBeSigned))).Split('=')[0].Replace('+', '-').Replace('/', '_')

$headers=@{}
$headers.Add("X-Lti-Signature", "$Signature")
$headers.Add("Content-Type", "application/json")

$meetingID = "Zoom meeting ID, no spaces"
$contextID = "from your LMS course"

$APIbody = "[{`"meetingId`": `"" + $meetingID + "`",`"contextId`": `"" + $contextID + "`",`"domain`": `"https://yourlmsdomain.com`"}]"

#Import
$uri = 'https://applications.zoom.us/api/v1/lti/rich/meeting/bulkImport?key=' + $lti_key + '&timestamp=' + $exp + '000' 
Invoke-RestMethod $uri -Method 'POST' -Headers $headers -ContentType 'application/json' -Body $APIbody

#Disassociate
#$uri = 'https://applications.zoom.us/api/v1/lti/rich/meeting/bulkDisassociate?key=' + $lti_key + '&timestamp=' + $exp + '000' 
#Invoke-RestMethod $uri -Method 'PUT' -Headers $headers -Body $APIbody
2 Likes