Skip to main content

Updating resources with The Python SDK

You can use the SDK to update resources.

For example, you can run a script to update a work group, also known as a governance group.

This example 'update WorkGroup' script updates the description for the work group created in Create a Resource. Copy it into your Python project to try it out:

import sailpoint
import sailpoint.v3
import sailpoint.beta
from sailpoint.beta.models.workgroup_dto import WorkgroupDto
from sailpoint.beta.models.usage_type import UsageType
from sailpoint.beta.models.owner_dto import OwnerDto
from sailpoint.beta.models.json_patch_operation import JsonPatchOperation
from sailpoint.beta.models.json_patch_operation_value import JsonPatchOperationValue
from sailpoint.configuration import Configuration

configuration = Configuration()

api_client = sailpoint.v3.ApiClient(configuration)
api_client_beta = sailpoint.beta.ApiClient(configuration)

identities_api_instance = sailpoint.v3.PublicIdentitiesApi(api_client)
workgroups_api_instance = sailpoint.beta.GovernanceGroupsApi(api_client_beta)

workgroup = workgroups_api_instance.list_workgroups(filters='name eq "DB Access Governance Group"')[0]

json_patch_operation = [JsonPatchOperation(op='replace', path='/description', value=JsonPatchOperationValue('This is an updated description for the workgroup.'))]

workgroupResponse = workgroups_api_instance.patch_workgroup(,json_patch_operation=json_patch_operation)
print("The response of GovernanceGroupsApi->patch_workgroup:\n")
except Exception as e:
print("Exception when calling GovernanceGroupsApi->patch_workgroup: %s\n" % e)

Run this command to run the code:


The example uses a PATCH replace operation to update the value in the /description path to "This is an updated description for the workgroup."

The SDK will return the updated work group with its new description:

The response of GovernanceGroupsApi->patch_workgroup:

name='DB Access Governance Group'
description='This is an updated description for the workgroup.'
name='Brian Mendoza')