I am having trouble updating a source attribute using the PATCH request type in the Sources API Python library. My script:
import sys
from sailpoint.v2025.api.sources_api import SourcesApi
from sailpoint.v2025.api_client import ApiClient
from sailpoint.v2025.models.json_patch_operation import JsonPatchOperation
from sailpoint.v2025.models.source import Source
from sailpoint.configuration import Configuration
configuration = Configuration()
source = sys.argv[1]
op = '''{"op":"replace", "path":"/connectorAttributes/deltaAggregationEnabled", "value":"false"}'''
operation = JsonPatchOperation.from_json(op)
with ApiClient(configuration) as api_client:
try:
results = SourcesApi(api_client).update_source(id=source, json_patch_operation=operation)
print(results.model_dump_json(by_alias=True, indent=4))
except Exception as e:
print("Exception when calling SourcesApi->update_source: %s\n" % e)
The output when running this is as follows:
Exception when calling SourcesApi->update_source: 3 validation errors for SourcesApi.update_source
json_patch_operation.0
Input should be a valid dictionary or instance of JsonPatchOperation [type=model_type, input_value=('op', 'replace'), input_type=tuple]
For further information visit https://errors.pydantic.dev/2.11/v/model_type
json_patch_operation.1
Input should be a valid dictionary or instance of JsonPatchOperation [type=model_type, input_value=('path', '/connectorAttri...eltaAggregationEnabled'), input_type=tuple]
For further information visit https://errors.pydantic.dev/2.11/v/model_type
json_patch_operation.2
Input should be a valid dictionary or instance of JsonPatchOperation [type=model_type, input_value=('value', UpdateMultiHost...int', 'object', 'str'})), input_type=tuple]
For further information visit https://errors.pydantic.dev/2.11/v/model_type
Also, if the JsonPatchOperation is created in the way suggested on the API docs:
op = '''[{op=replace, path=/connectorAttributes/deltaAggregationEnabled, value=false}]'''
operation = JsonPatchOperation.from_json(op)
There is a different error, that I think makes more sense, but still doesn’t function properly. The docs may need an update since the string fed to from_json() isn’t valid JSON.
Exception when calling SourcesApi->update_source: Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
Any suggestions to fix this?
