Way to get the license count by using Rest api

Krishna m
Contributor
August 6, 2018

I wanted to see if there is a Way to get the license count by using Rest api. This is for JIRA Cloud instance . If yes , Can some one post the url which I can access to get the metrics . Thanks .

 

 

Note : I am using the below url but i am getting 404 error

 

https://<My url>/rest/plugins/applications/1.0/installed/jira-software

1 answer

1 vote
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 10, 2018

Hi Krishna,

Check out the applicationrole endpoint - here's the documentation for it.

The roles are sorted by application (Core, Software, Service Desk) and will return info about how many seats are available and how many are left:

    "numberOfSeats": 10,
    "remainingSeats": 5,
    "userCount": 5,

Cheers,
Daniel

Jerry Laster [Divim, Inc.]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 1, 2019

Hi @Daniel Eads 

Apps cannot access this REST resource.

Is there another way to get programmatically this information from the app?

Thanks,

Jerry

Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 1, 2019

Hey @Jerry Laster [Divim, Inc.] ,

You as a user of a particular Atlassian Cloud instance should be able to access the details from this endpoint still. In the last year since this question was raised, we have changed the Cloud APIs to use tokens for authorization instead of passwords.

Apps in this context refer to items you may install in your instance from Atlassian Marketplace. Scripts making API calls should be fine (provided they use an API token).

Does that help? Or are you developing a plugin that you plan to distribute on Marketplace that would need access to the license counts?

Thanks,
Daniel | Atlassian Support

Scott R February 18, 2021

Was this question ever answered? 

I need to find a method to automate the monitoring of our licenses for our enterprise. Has any progress been made on this front?

Like Adam Sterrie likes this
Krishna m
Contributor
February 18, 2021

@Scott R  Below is the Powershell script I use to get the user count 

(Plug in your username and api key in line 1 and your Jira URI in line 4 .  Rest Remains the same )

 

$user    = [System.Text.Encoding]::UTF8.GetBytes(“yourusername:apikey”)

$headers = @{Authorization = "Basic " + [System.Convert]::ToBase64String($user)}

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$result = Invoke-RestMethod -Uri "https://jira.atlassian.net/rest/api/latest/applicationrole" -Method GET -Headers $headers -ContentType "application/json"

$count=$result.userCount

Like Scott R likes this
Scott R March 8, 2024

This is amazing!! Thank you so much for sharing this! 

Unfortunately, it only provides Jira information.. but it's a start

Suggest an answer

Log in or Sign up to answer