Showing results for 
Search instead for 
Did you mean: 

AMA-CUCM Troubleshooting: Best Practices for Reading Trace Files


Spark API [PowerShell] Removing a License

We currently are setup to use the directory connector to sync our users from Active Directory to Cisco Spark. That is working now that a major bug was patched on Cisco's backend code. Anyway, we found out that when you remove a user in Active directory it removes the user from Spark (as expected). However it does not release the number assigned the that user.

My proposed solution was to use powershell and the spark APIs to remove the call license, as suggested by Cisco. This would release the number back to being available for use. Is it possible to unassign licenses using the Spark APIs, specifically for an AD synced user?

[UPDATE 1] Working with devsupport to work through this.

[UPDATE 2] I finally have this working with powershell. Below is my code in case anyone is interested.


## Reference


## Organization ID

$orgID = "[ORG ID HERE]"

# Cisco Spark License IDs

$call = '[CALL LICENSE ID HERE]' # Cisco Spark Call License

$meet = '[MEETING LICENSE ID HERE]' # Cisco Spark 25 Meeting Party License

$message = '[MESSAGE LICENSE ID HERE]' # Cisco Spark Messaging

# Get-License Information

Invoke-RestMethod -uri "" -ContentType application/json -Method Get -Headers @{Authorization = '[AUTH CODE HERE]'} | Select -ExpandProperty items | Out-Host

# Get Person

$sparkperson = Invoke-RestMethod -uri "" -ContentType application/json -Method Get -Headers @{Authorization = '[AUTH CODE HERE]'} | Select -ExpandProperty items | ? {$_.emails -like '*bob.smith*'}

# Person Parameters

$params = @{

###Uncomment this out to add licenses ###'licenses'= @("$meet", "$message","$call")






} | ConvertTo-Json

# Update Person

Invoke-RestMethod -uri "$($" -ContentType application/json -Method Put -Headers @{Authorization = '[AUTH CODE HERE]'} -Body $params

So In line 26 of the script, you can uncomment the line to add licenses. You can pick and choose which licenses you want to assign or not assign.

Message was edited by: John Kuntz Added powershell script

Everyone's tags (4)

Re: Spark API [PowerShell] Removing a License


thanks for the script, I've found quite little powerhell and spark. Unfortunately, I get the following message when running: Do you have a hint?

Invoke-RestMethod: {"message": "Request method 'PUT' not supported", "errors": [{"description": "Request method 'PUT' not supported"}]

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards