Set license issue with rest/plugins/1.0/{pluginKey}/license

Shirley Tsai May 4, 2020

All,

I'm looking for a solution to update the plugin license, I learn below article which it can set the license for Jira software/servicedesk/core, it's very useful for me.

https://confluence.atlassian.com/jirakb/how-to-retrieve-application-license-details-or-set-the-license-via-private-rest-api-in-jira-7+-934728265.html?_ga=2.57725353.225961834.1588033245-1404324419.1573778045

I also would like the same way to update the plugin license, but I encounter an issue and got "upm.plugin.license.error.invalid.update".

How do I use the correct license name/field in the Request Body for the plugin? Do we have any related KB as this article?

REST API
rest/plugins/1.0/{pluginKey}/license

Method
PUT

Parameter
pluginKey: com.eazybi.jira.plugins.eazybi-jira-key

Request Body
{
"licenseKey": xxx
}
Response
{
"subCode": "upm.plugin.license.error.invalid.update"
}

Thanks,
Shirley

1 answer

1 accepted

0 votes
Answer accepted
Volodymyr Havryliuk November 2, 2020

Hello, @Shirley Tsai

You should use the following request body

{
"rawLicense":"license key here"
}

 and Content-Type: application/vnd.atl.plugins+json

Shirley Tsai November 2, 2020

Hi @Volodymyr Havryliuk

Thanks for the feedback.  I'm glad of your reply. At the beginning, I'm were finding the way and it's so hard.  Now, I already figure out how to use this REST API and implement it to update add-on licenses via Ansible playbook as well.

- name: Update the license of add-on
uri:
url: "https://{{ alias_name }}/jira/rest/plugins/1.0/{{ item.name }}-key/license"
method: PUT
user: account
password: "{{ password}}"
body: '{ "rawLicense":"{{ item.license }}"}'
headers:
Content-Type: "application/vnd.atl.plugins+json"
body_format: json
force_basic_auth: yes
return_content: yes
status_code: 200
with_items:
- { name: '{{ pluginkeys[0] }}', license: '{{ licenses[0] }}' }
Like Volodymyr Havryliuk likes this
chunyuan_qian January 27, 2021

Hi,I also want to update plugin license  by using  REST API. But the result is  :

"upm.plugin.license.error.invalid.license"

the method is :put

the URL is :

https://***/jira/rest/plugins/1.0/com.onresolve.jira.groovy.groovyrunner-key/license

Content-Type is : application/vnd.atl.plugins+json 

{"rawLicense":"***“}

Diffierent from you my body is text,when i try to change the type to json ,the Content-Type will change .

could you help me?

Shirley Tsai January 27, 2021

Hi Chunyuan,

Do you use Curl command or REST API from Jira Admin? Could you provide your command?

Thanks,
Shirley

chunyuan_qian February 1, 2021

hi Shirley

thank you for your help

i use Curl command ,now it's success! thank you 

Wajih Zouaoui March 24, 2021

Hi @chunyuan_qian 

 

could you please provide us the curl command you have already used ?

 

Thanks in advance.

 

Wajih

Martin Baltuhin February 22, 2022

in help of future lost souls, updating plugin license with curl:

curl -H "Content-Type: application/vnd.atl.plugins+json" -H "X-Atlassian-Token: no-check" -u $USERNAME:$PASSWORD -X PUT https://baseurl/rest/plugins/1.0/$PLUGIN_KEY-key/license -d {\"rawLicense\":\"licensewithnospaces\"}

 Please note the escape chars on the curl request body, and the -key in the url, after the plugin key, this is not part of the key(!?). No docs for UPM is terrible :/

Suggest an answer

Log in or Sign up to answer