bart.wille
(Bart Wille)
January 21, 2025, 10:05am
1
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?
KIRTI_IYER
(KIRTI IYER)
January 21, 2025, 11:09am
2
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
The UiPath Documentation Portal - the home of all our valuable information. Find here everything you need to guide you in your automation journey in the UiPath ecosystem, from complex installation guides to quick tutorials, to practical business...
bart.wille
(Bart Wille)
January 21, 2025, 12:06pm
4
No, these are variables.
If this would be the issue then the error msg would be different.
bart.wille
(Bart Wille)
January 21, 2025, 12:12pm
5
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?
1st - always add/list/edit what I you need in your Browser + F12, to pinpoint the proper definition of the body.
[image]
Note: the AssetDTO differs a little bit depending on what ‘Type’ of asset you are adding. For Credentials I only add a stub. My DevOps team later edit this Asset from Orch and adds the actual password.
I stumble on the [Int] value for CredentialStoreId (yes needs to be an int i json, not String)
[image]
In PowerShell I use a Switch statement + a proper Object ($json)…
Regards
Sonali
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
bart.wille
(Bart Wille)
January 22, 2025, 11:27am
10
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
system
(system)
Closed
January 25, 2025, 11:28am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.