API PUT Assets - 1502 AssetTypeNonUpdatable

On using the Assets’ PUT API, I always get this error: 1502 AssetTypeNonUpdatable.

My function:

def set_asset_value(access_token, organization_unit_id, base_url, asset_id, new_value, field_name):
    url = f'{base_url}/odata/Assets({asset_id})'

    headers = {
        'Authorization': f'Bearer {access_token}',
        'X-UIPATH-OrganizationUnitId': str(organization_unit_id),
        'Content-Type': 'application/json'
    }

    asset = {
        "Id": asset_id,
        "Name": field_name,
        "Value": new_value
    }

    response = requests.put(url, json=asset, headers=headers)
    response.raise_for_status()

Note:

  • I have the necessary rights
  • the GET API works correctly
  • the id and name are correct (if they wouldn’t be correct then I would get another error msg)

Orchestrator - Response Codes
1502: AssetTypeNonUpdatable: The asset type cannot be updated. → This error is thrown if you are trying to change the asset type through a PUT request.

Am I doing something wrong or is the PUT API not meant to be used?

Hi @bart.wille

Double quotes must be used to encapsulate field_name and new_value.

Hi @bart.wille ,

Refer the UiPath Swagger portal,
there you can find the Asset update related API’s. Follow below documentation

No, these are variables.
If this would be the issue then the error msg would be different.

Do you mean the PUT API? Bcs I’ve checked the Orchestrator Swagger and under “Assets” there is a PUT but no UPDATE

Hi @bart.wille,

Can you also provide the asset type please while using PUT request?

Regards
Sonali

Asset type: Text

Hi @bart.wille,

even though, its text, can you trying mentioning it specifically and see if it works?

Regards
Sonali

Hi @bart.wille,
I tried to update the value through postman and i am able to update the asset value,
Below are the details i used,

Method: Put
URL:{YourOrchestratorURL}t/orchestrator_/odata/Assets(YourAssetID)
Headers:
X-UiPath-OrganizationUnitId: YourFolderID
Authorization: Bearer Token
Body:
{
“Id”: {{ID}},
“StringValue”: “YourNewValueToUpdate”,
“ValueType”: “YourAssetType”,
“Name”: “YourAssetName”,
“Description”: “Your Discription”
}

try these inputs and let me know still facing any error

Hi, Thanks a lot!

To clarify, I updated my json to this:

  asset = {
        "Id": asset_id,
        "StringValue": new_value,
        "ValueType": "Text",
        "Name": field_name
    }

Instead of “Value” I used “StringValue” and I specified the “ValueType”.

1 Like

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