I want to create/update Asset with Boolean value via orchestrator Api
JSON payload:
ex: URL odata/Assets(AssetID)
Body:
{
“Name”:“BooleanAsset”,
“ValueScope”:“global/per robot”,
“valueType”:“Bool”,
“Boolvalue”: true,
“ID”: assetid
}
But it is not working…
Please note, I am able to create/update string asset value via Orchestrator API but unable to do for boolean asset as it only takes boolean variable and JSON playload takes string value.
Any input please??
Nitya1
(Nitya Tomar)
April 30, 2023, 12:28pm
2
Hi @Pinky_AG
When working with boolean values in JSON payloads, we have to ensure that we are using the correct syntax to represent the boolean value.
In JSON, true and false are not surrounded by quotes, unlike string values.
Here is an example of a JSON payload to create/update a boolean asset in Orchestrator using the API:-
{
“Name”: “BooleanAsset”,
“ValueScope”: “Global”,
“ValueType”: “Bool”,
“BoolValue”: true,
“Id”: “assetid”
}
Thanks!!
Anil_G
(Anil Gorthi)
April 30, 2023, 12:39pm
3
@Pinky_AG
Value is missing in the payload…please try with this …it is working as expected
{
"Name": "testbool2",
"CanBeDeleted": true,
"ValueScope": "Global",
"ValueType": "Bool",
"Value": "true",
"BoolValue": true
}
Cheers
2 Likes
I tried this method but it always gives me 400 error.
Processing: 16829377900118510834023628930330.jpg…
You have multiple ways to update a Boolean Asset in Orchestrator.
Use the Set Asset activity from the UiPath.System.Activities package
Use a Rest API call for "/odata/Assets(your_asset_ID)"
in an HTTP Request activity from the UiPath.WebAPI.Activities package
Example:
Request URL: "https://cloud.uipath.com/your_org_name/your_tenant_name/orchestrator_/odata/Assets(your_asset_ID)"
Method: PUT
Accept Format: JSON
Body:
"{""Id"":743120,""BoolValue"":false,""ValueType"":""Bool"",""Name"":""BooleanAssetTest"",""Description"":null,""ValueScope"":""Global"",""HasDefaultValue"":true,""CanBeDeleted"":true,""Key"":""a3d56021-20f1-4348-bfcb-2d5e623499b5"",""Tags"":[]}"
Body Format: application/json
Headers
Authorization: “Bearer ey…”
x-UiPath-organizationunitid: “YOUR_FOLDER_ID”
content-type: “application/json”
Results: