Below is the Python code to get the groups in Jira. You need to install a request library for this. Here is the code:
import requests
url = "https://your jira address here/rest/api/2/user/groups?Name=jira name " \
"&accountId=account-id&username=username "
payload={}
headers = {
'User-Agent': 'Apidog/1.0.0 (https://apidog.com)'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
=============================================================
import requests
from requests.auth import HTTPBasicAuth
import json
url = "https://your jira address here/rest/api/3/group"
auth = HTTPBasicAuth("username", "jira access token")
headers = {
"Accept": "application/json"
}
query = {
'groupId': 'groupId'
}
response = requests.request(
"GET",
url,
headers=headers,
params=query,
auth=auth
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Comments
Post a Comment