I could install the app with
POST {{cloudBaseUrl}}/rest/plugins/1.0?token=...
For licensing I tried to use
PUT {{cloudBaseUrl}}/rest/plugins/1.0/{{cloudPluginKey}}-key/license
and POST, but I keep on getting “405 Method not allowed”. Is there any documentation on this, or should this not be used?
@m.schmidt ,
These are some old REST APIs and I’m not sure if they all work as documented. Moreover, what documentation exists is piecemeal:
On that 2nd page with might have the clue with, “Using sysadmin credentials”, which is meant to mean basic auth with username and password (not API token).
The POST/PUT part is not too explicit there …
Funny enough I found a npm package, that does it quite well, written by someone of our company … And it works with this.
@resolution /atlassian-upm-client
1 Like
Thanks @christopher , we answered litereally in the same minute I’ll look into it.
If you are interested in doing this via your command line, you could also use my cli for this: GitHub - craftamap/pluploader: A simple plugin uploader for atlassian server tools written in python
return "subCode" not in response_json and response_json["enabled"] == enable
def get_license(self, plugin_key: str) -> License:
request_url = self.base_url.copy()
request_url.add(path=self.UPM_API_ENDPOINT)
request_url.add(path=plugin_key + "-key")
request_url.add(path="license")
response = requests.get(request_url.url)
return License.decode(response.json())
def update_license(self, plugin_key: str, raw_license: str):
request_url = self.base_url.copy()
request_url.add(path=self.UPM_API_ENDPOINT)
request_url.add(path=plugin_key + "-key")
request_url.add(path="license")
headers = {"Content-Type": "application/vnd.atl.plugins+json"}
try:
response = requests.put(request_url.url, json={"rawLicense": raw_license}, headers=headers)
return License.decode(response.json())
except Exception:
raise ValueError(response.status_code, response.content)
1 Like