Can't update the permission scheme of a project via the correct json?

Piyush A (STR)
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 18, 2023

How to update the permission scheme of a project to a new role id:

role_a_id - id of role source

role_a_id - id of role to replace to
def permissionSchemeUpdate(project_key,role_a_id,role_b_id):
    permission_schemes = jira.project_permissionscheme(project_key)
    print(f"project Key: {project_key} --> Permission Scheme: {permission_schemes.name}")
    scheme_url = f'{urlBase}/rest/api/3/permissionscheme/{permission_schemes.id}'
    response = requests.get(scheme_url, auth=(username, api_token), headers=headers)
    scheme_data = response.json()
    for scheme in scheme_data['permissions']:
        if role_a_id == scheme['holder']['value']:
            print(f"Role found for '{project_key}' at {scheme['permission']}")
            update_url = f'{urlBase}/rest/api/3/permissionscheme/{scheme_data["id"]}'
            scheme['holder']['parameter'] = role_b_id
            scheme['holder']['value'] = role_b_id
            response = requests.put(update_url, auth=(username, api_token), headers=headers, json=scheme_data)
            print(scheme_data['name'])
            if response.status_code == 200:
                print(f"Permission updated in scheme '{scheme_data['name']}'")
Error: Name required field not passed.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events