# Patch Role Python SDK

**URL:** <https://developer.sailpoint.com/discuss/t/patch-role-python-sdk/193332>\
**Category:** SHF Discussion and Questions\
**Tags:** python-sdk, sailpoint-identity-security, roles, apis\
**Created:** [January 14, 2026, 12:30pm UTC](https://developer.sailpoint.com/discuss/t/patch-role-python-sdk/193332 "2026-01-14T12:30:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhekamandla](https://avatars.discourse-cdn.com/v4/letter/b/58956e/32.png) [@Bhekamandla](https://developer.sailpoint.com/discuss/u/Bhekamandla)\
**Post date:** [January 14, 2026, 12:30pm UTC](https://developer.sailpoint.com/discuss/t/patch-role-python-sdk/193332/1 "2026-01-14T12:30:40Z")

</div>

Hi community,

I need assistance with patching a role using the Python SDK.

Below is my code showing how I have created JsonPatchOperation.

```python
## Approach 1
approvers = [
        ArrayInner(approver_type="GOVERNANCE_GROUP", approver_id="redacted"),
        ArrayInner(approver_type="MANAGER", approver_id=""),
    ]

    json_patch_operations = [
        JsonPatchOperation(
            op="replace",
            path="/accessRequestConfig/approvalSchemes",
            value=UpdateMultiHostSourcesRequestInnerValue(approvers)
        )
    ]

## Approach 2    
json_patch_operations = [
        JsonPatchOperation.from_dict({
            "op": "replace",
            "path": "/accessRequestConfig/approvalSchemes",
            "value": [
                {
                    "approverType": "GOVERNANCE_GROUP",
                    "approverId": "redacted"
                },
                {
                    "approverType": "MANAGER",
                    "approverId": None
                }
            ]
        })
    ]

try:
                with sailpoint.v2025.ApiClient(configuration) as api_client:
                    roles_api = sailpoint.v2025.RolesApi(api_client)
                    roles_api.patch_role(id=access.id, json_patch_operation=json_patch_operations)

            except Exception as e:
                print(f"Error updating access '{access.id}': {e}")

```

Both approach 1 and approach 2 are returning the same exception, “‘NoneType’ object has no attribute ‘items’. ‘The role is currently enabled and requestable with the approvalSchemes currently null.

Can anyone please suggest a resolution to this or a different way of changing the approval schemes.

Regards,  
Bhekamandlenkosi

---

<div class="post-metadata">

**Author:** ![kevisoliveira](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kevisoliveira/32/25510_2.png) [@kevisoliveira](https://developer.sailpoint.com/discuss/u/kevisoliveira)\
**Post date:** [January 14, 2026, 7:35pm UTC](https://developer.sailpoint.com/discuss/t/patch-role-python-sdk/193332/2 "2026-01-14T19:35:58Z")

</div>

Hi, @Bhekamandla.

Welcome back.

Silly question here, what if you change the “op” from “replace” to “add”?

If “approvalSchemes” is currently null, replace may fail because the field doesn’t exist yet.

---

<div class="post-metadata">

**Author:** ![lampard08](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/lampard08/32/32646_2.png) [@lampard08](https://developer.sailpoint.com/discuss/u/lampard08)\
**Post date:** [January 15, 2026, 12:49am UTC](https://developer.sailpoint.com/discuss/t/patch-role-python-sdk/193332/3 "2026-01-15T00:49:08Z")

</div>

try to print you payload and see how its being transformed.

in you 2nd approach, just change the `"approverId": None` to `"approverId": ““`

below payload worked for me and you are fine with using replace op :

```auto
{

        "op": "replace",

        "path": "/accessRequestConfig/approvalSchemes",

        "value": [

            {

                "approverType": "GOVERNANCE_GROUP",

                "approverId": "111xxxx-xxxx-yyyy-1111-123651100000"

            },

            {

                "approverType": "MANAGER",

                "approverId": ""

            }

        ]

    }

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [March 16, 2026, 12:49am UTC](https://developer.sailpoint.com/discuss/t/patch-role-python-sdk/193332/4 "2026-03-16T00:49:29Z")

</div>

Closed on March 16, 2026, 12:49am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
