Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,683
Community Members
 
Community Events
165
Community Groups

Update License via REST returns code 415

I have several host licenses to update and i want to automate it. Getting license works without issues. Setting license does not work, returns response code 415 without any text.

Using python3.

Headers:

headers = {"Content-Type": "application/json", "Accept": "*", "Authorization": "Basic "+encoded} 

and the test get request:

response = requests.get(jira_base+"/rest/plugins/applications/1.0/installed/jira-software/license", headers=headers)

this works. 
Setting the license does not. Using same headers and this is my request.

data = {
"licenseKey": "<MyLicenseKey>"
}
headers = {"Content-Type": "application/json", "Authorization": "Basic "+encoded}
response = requests.post(jira_base+"/rest/plugins/applications/1.0/installed/jira-software/license", headers=headers, data=json.dumps(data))

 following this page: https://confluence.atlassian.com/jirakb/how-to-retrieve-application-license-details-or-set-the-license-via-private-rest-api-in-jira-7+-934728265.html

and i get <Response [415]> without any other info.

1 answer

0 votes

I use the next method

def update_plugin_license(self, plugin_key, raw_license):
"""
Update license for plugin
:param plugin_key:
:param raw_license:
:return:
"""
app_headers = {
"X-Atlassian-Token": "no-check",
"Content-Type": "application/vnd.atl.plugins+json",
}
url = "rest/plugins/1.0/{plugin_key}/license".format(plugin_key=plugin_key)
data = {"rawLicense": raw_license}
return self.put(url, data=data, headers=app_headers)

Wow, thank you! Does this work for Jira license itself?

Like Gonchik Tsymzhitov likes this

For the Jira License, I did not test yet

https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/jira.py#L2825

 

once it's ready I will share info

I am still getting 405:

HTTPError: 405 Client Error: for url: http://jira:8080/plug
ins/1.0/org.everit.jira.timetracker.plugin/license

i am using this:

response = jira.update_plugin_license(plugin['key'], raw_license) 

is there any specific way you have to format the license itself? Does this work with later versions?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,481 views 37 44
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you