# Patch Source App with Python SDK

**URL:** <https://developer.sailpoint.com/discuss/t/patch-source-app-with-python-sdk/143729>\
**Category:** SHF Discussion and Questions\
**Tags:** sailpoint-identity-security, apis\
**Created:** [June 11, 2025, 4:39pm UTC](https://developer.sailpoint.com/discuss/t/patch-source-app-with-python-sdk/143729 "2025-06-11T16:39:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smc-sp](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@smc-sp](https://developer.sailpoint.com/discuss/u/smc-sp)\
**Post date:** [June 11, 2025, 4:39pm UTC](https://developer.sailpoint.com/discuss/t/patch-source-app-with-python-sdk/143729/1 "2025-06-11T16:39:46Z")

</div>

Hi All,

I am trying to use the Python SDK to add an Access Profile to an existing SourceApp using the patch\_source\_app method.

When I try:

```auto
source_app = AppsApi(api_client).patch_source_app(
                              source_app_id, 
                              [{ "op": "add", 
                                  "path": "/accessProfiles/-", 
                                  "value": {
                                            "type": "ACCESS_PROFILE", 
                                             "id": "eaf17124b594ed786ddd31132334fbe",
                                             "name": "AP-1"}
                                    }])

```

or

```auto
source_app = AppsApi(api_client).patch_source_app(
                            source_app_id, 
                            [{ "op": "add", 
                             "path": "/accessProfiles/-", 
                            "value": {"id": "eaf17124b594ed786ddd31132334fbe"}}])

```

The error I am getting is error:  
“The server did not find a current representation for the target resource”

I have also tried to marshal the dictionary into a JsonPatchOperation and send it that way but same issue.

Also, if I try like this - which is similar to be the way the API docs show:

```auto
 source_app = AppsApi(api_client).patch_source_app(
                                 source_app_id, 
                                 [{ "op": "add", 
                                     "path": "/accessProfiles/-", 
                                     "value": "eaf17124b594ed786ddd31132334fbe"
                                  }])

```

I get the following (Pydantic?) type error:

“Failed to patch source app: 1 validation error for AppsApi.patch\_source\_app 2.0.value Input should be a valid dictionary or instance of UpdateMultiHostSourcesRequestInnerValue [type=model\_type, input\_value=‘eaf17124b594ed786ddd31132334fbe’, input\_type=str]”

If anyone has an example of what the JSON patch object and path should look like I would appreciate any help.

I can patch the SourceApp successfully with normal Python requests like so:

```auto
    with session as s:
        url = f"{base_url}/beta/source-apps/50b16b4225548ceb8cdfb38335d4b69"
        data = '[{ "op": "add", "path": "/accessProfiles/-", "value": "eaf17124b594ed786ddd31132334fbe" }]'

        headers = {
            "Authorization": f"Bearer {access_token}",
            "cache-control": "no-cache",
            "Accept": "application/json",
            "Content-Type": "application/json-patch+json",
        }

        try:
            response = s.patch(url=url, data=data, headers=headers)

```

I have referenced the following and have read the SDK code base but cannot figure it out:

- [API Patch Role - Semantically Invalid](https://developer.sailpoint.com/discuss/t/api-patch-role-semantically-invalid/110278)
- [Apps | SailPoint Developer Community](https://developer.sailpoint.com/docs/tools/sdk/python/v2024/methods/apps#patch-source-app)
- [patch-source-app | SailPoint Developer Community](https://developer.sailpoint.com/docs/api/v2024/patch-source-app/)
- [Updating resources with The Python SDK | SailPoint Developer Community](https://developer.sailpoint.com/docs/tools/sdk/python/update)

---

<div class="post-metadata">

**Author:** ![smc-sp](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@smc-sp](https://developer.sailpoint.com/discuss/u/smc-sp)\
**Post date:** [June 12, 2025, 10:58am UTC](https://developer.sailpoint.com/discuss/t/patch-source-app-with-python-sdk/143729/2 "2025-06-12T10:58:12Z")

</div>

OK, this example works:

```auto
    from sailpoint.v2024.api.apps_api import AppsApi
    from sailpoint.v2024.models.json_patch_operation import JsonPatchOperation

                    patch_list = []
                    patch_list.append(
                        JsonPatchOperation.from_dict(
                            {
                                "op": "add",
                                "path": "/accessProfiles/-",
                                "value": "eaf17124b594ed786ddd31132334fbe",
                            }
                        )
                    )
                    try:
                        source_app: List[SourceApp] = AppsApi(
                            api_client
                        ).patch_source_app(source_app_id, patch_list)

```

---

<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:** [August 11, 2025, 10:58am UTC](https://developer.sailpoint.com/discuss/t/patch-source-app-with-python-sdk/143729/3 "2025-08-11T10:58:20Z")

</div>

Closed on August 11, 2025, 10:58am UTC

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