PowerBuilder / Orchestrator / Assets - Get all + Per Robot Values
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Name
integer li_CanBeDeleted
string ls_ValueScope
string ls_ValueType
string ls_Value
string ls_StringValue
integer li_BoolValue
integer li_IntValue
string ls_CredentialUsername
string ls_CredentialPassword
string ls_ExternalName
string ls_CredentialStoreId
integer li_HasDefaultValue
string ls_Description
integer li_Id
integer j
integer li_Count_j
integer li_RobotId
string ls_RobotName
string ls_KeyTrail
integer k
integer li_Count_k
string ls_Odata_context
integer li_Odata_count
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")
loo_QueryParams.UpdateString("$expand","RobotValues")
loo_Http.SetRequestHeader("Content-Type","application/json")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Http.SetRequestHeader("X-UIPATH-OrganizationUnitId","{{folderId}}")
loo_Http.SetRequestHeader("X-UIPATH-TenantName","{{tenantName}}")
loo_Resp = loo_Http.QuickRequestParams("GET","https://domain.com/odata/Assets",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_QueryParams
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "@odata.context": "https://platform.uipath.com/deanmauro/dean/odata/$metadata#Assets",
// "@odata.count": 2,
// "value": [
// {
// "Name": "Asset 2",
// "CanBeDeleted": true,
// "ValueScope": "Global",
// "ValueType": "Text",
// "Value": "I would not, Cassius, yet I love him well.",
// "StringValue": "I would not, Cassius, yet I love him well.",
// "BoolValue": false,
// "IntValue": 0,
// "CredentialUsername": "",
// "CredentialPassword": "",
// "ExternalName": "",
// "CredentialStoreId": null,
// "HasDefaultValue": true,
// "Description": null,
// "Id": 8588,
// "KeyValueList": [
// ],
// "RobotValues": [
// ]
// },
// {
// "Name": "blah",
// "CanBeDeleted": true,
// "ValueScope": "PerRobot",
// "ValueType": "Integer",
// "Value": null,
// "StringValue": "",
// "BoolValue": false,
// "IntValue": 0,
// "CredentialUsername": "",
// "CredentialPassword": "",
// "ExternalName": "",
// "CredentialStoreId": null,
// "HasDefaultValue": false,
// "Description": null,
// "Id": 23656,
// "KeyValueList": [
// ],
// "RobotValues": [
// {
// "RobotId": 33530,
// "RobotName": "joe",
// "KeyTrail": "***4ef589a",
// "ValueType": "Integer",
// "StringValue": "",
// "BoolValue": false,
// "IntValue": 1,
// "Value": "1",
// "CredentialUsername": "",
// "CredentialPassword": "",
// "ExternalName": "",
// "CredentialStoreId": null,
// "Id": 199104,
// "KeyValueList": [
// ]
// },
// {
// "RobotId": 42307,
// "RobotName": "jose",
// "KeyTrail": "***88bvb04",
// "ValueType": "Integer",
// "StringValue": "",
// "BoolValue": false,
// "IntValue": 2,
// "Value": "2",
// "CredentialUsername": "",
// "CredentialPassword": "",
// "ExternalName": "",
// "CredentialStoreId": null,
// "Id": 199105,
// "KeyValueList": [
// ]
// }
// ]
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Odata_context = loo_JResp.StringOf("~"@odata.context~"")
li_Odata_count = loo_JResp.IntOf("~"@odata.count~"")
i = 0
li_Count_i = loo_JResp.SizeOfArray("value")
do while i < li_Count_i
loo_JResp.I = i
ls_Name = loo_JResp.StringOf("value[i].Name")
li_CanBeDeleted = loo_JResp.BoolOf("value[i].CanBeDeleted")
ls_ValueScope = loo_JResp.StringOf("value[i].ValueScope")
ls_ValueType = loo_JResp.StringOf("value[i].ValueType")
ls_Value = loo_JResp.StringOf("value[i].Value")
ls_StringValue = loo_JResp.StringOf("value[i].StringValue")
li_BoolValue = loo_JResp.BoolOf("value[i].BoolValue")
li_IntValue = loo_JResp.IntOf("value[i].IntValue")
ls_CredentialUsername = loo_JResp.StringOf("value[i].CredentialUsername")
ls_CredentialPassword = loo_JResp.StringOf("value[i].CredentialPassword")
ls_ExternalName = loo_JResp.StringOf("value[i].ExternalName")
ls_CredentialStoreId = loo_JResp.StringOf("value[i].CredentialStoreId")
li_HasDefaultValue = loo_JResp.BoolOf("value[i].HasDefaultValue")
ls_Description = loo_JResp.StringOf("value[i].Description")
li_Id = loo_JResp.IntOf("value[i].Id")
j = 0
li_Count_j = loo_JResp.SizeOfArray("value[i].KeyValueList")
do while j < li_Count_j
loo_JResp.J = j
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("value[i].RobotValues")
do while j < li_Count_j
loo_JResp.J = j
li_RobotId = loo_JResp.IntOf("value[i].RobotValues[j].RobotId")
ls_RobotName = loo_JResp.StringOf("value[i].RobotValues[j].RobotName")
ls_KeyTrail = loo_JResp.StringOf("value[i].RobotValues[j].KeyTrail")
ls_ValueType = loo_JResp.StringOf("value[i].RobotValues[j].ValueType")
ls_StringValue = loo_JResp.StringOf("value[i].RobotValues[j].StringValue")
li_BoolValue = loo_JResp.BoolOf("value[i].RobotValues[j].BoolValue")
li_IntValue = loo_JResp.IntOf("value[i].RobotValues[j].IntValue")
ls_Value = loo_JResp.StringOf("value[i].RobotValues[j].Value")
ls_CredentialUsername = loo_JResp.StringOf("value[i].RobotValues[j].CredentialUsername")
ls_CredentialPassword = loo_JResp.StringOf("value[i].RobotValues[j].CredentialPassword")
ls_ExternalName = loo_JResp.StringOf("value[i].RobotValues[j].ExternalName")
ls_CredentialStoreId = loo_JResp.StringOf("value[i].RobotValues[j].CredentialStoreId")
li_Id = loo_JResp.IntOf("value[i].RobotValues[j].Id")
k = 0
li_Count_k = loo_JResp.SizeOfArray("value[i].RobotValues[j].KeyValueList")
do while k < li_Count_k
loo_JResp.K = k
k = k + 1
loop
j = j + 1
loop
i = i + 1
loop
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -G -d "$expand=RobotValues"
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-H "X-UIPATH-TenantName: {{tenantName}}"
-H "X-UIPATH-OrganizationUnitId: {{folderId}}"
https://domain.com/odata/Assets
Postman Collection Item JSON
{
"name": "Assets - Get all + Per Robot Values",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "X-UIPATH-TenantName",
"value": "{{tenantName}}",
"type": "text"
},
{
"key": "X-UIPATH-OrganizationUnitId",
"value": "{{folderId}}",
"type": "text"
}
],
"url": {
"raw": "{{url}}/odata/Assets?$expand=RobotValues",
"host": [
"{{url}}"
],
"path": [
"odata",
"Assets"
],
"query": [
{
"key": "$expand",
"value": "RobotValues"
}
]
},
"description": "Get all Assets and display Per Robot values in the response. For global Assets, this call provides no extra features."
},
"response": [
{
"name": "Assets - Get all (Including Per Robot Values)",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{url}}/odata/Assets?$expand=RobotValues",
"host": [
"{{url}}"
],
"path": [
"odata",
"Assets"
],
"query": [
{
"key": "$expand",
"value": "RobotValues"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "CF-RAY",
"value": "443012f809dd91fa-EWR",
"name": "CF-RAY",
"description": "Custom header"
},
{
"key": "Cache-Control",
"value": "no-store, must-revalidate, no-cache, max-age=0",
"name": "Cache-Control",
"description": "Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds"
},
{
"key": "Connection",
"value": "keep-alive",
"name": "Connection",
"description": "Options that are desired for the connection"
},
{
"key": "Content-Encoding",
"value": "gzip",
"name": "Content-Encoding",
"description": "The type of encoding used on the data."
},
{
"key": "Content-Length",
"value": "588",
"name": "Content-Length",
"description": "The length of the response body in octets (8-bit bytes)"
},
{
"key": "Content-Type",
"value": "application/json; odata.metadata=minimal",
"name": "Content-Type",
"description": "The mime type of this content"
},
{
"key": "Date",
"value": "Tue, 31 Jul 2018 12:30:03 GMT",
"name": "Date",
"description": "The date and time that the message was sent"
},
{
"key": "Expect-CT",
"value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
"name": "Expect-CT",
"description": "Custom header"
},
{
"key": "OData-Version",
"value": "4.0",
"name": "OData-Version",
"description": "Custom header"
},
{
"key": "Server",
"value": "cloudflare",
"name": "Server",
"description": "A name for the server"
},
{
"key": "Set-Cookie",
"value": "; SameSite=lax",
"name": "Set-Cookie",
"description": "an HTTP cookie"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains",
"name": "Strict-Transport-Security",
"description": "A HSTS Policy informing the HTTP client how long to cache the HTTPS only policy and whether this applies to subdomains."
},
{
"key": "Vary",
"value": "Accept-Encoding",
"name": "Vary",
"description": "Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server."
},
{
"key": "X-Content-Type-Options",
"value": "nosniff",
"name": "X-Content-Type-Options",
"description": "The only defined value, \"nosniff\", prevents Internet Explorer from MIME-sniffing a response away from the declared content-type"
},
{
"key": "X-Frame-Options",
"value": "DENY",
"name": "X-Frame-Options",
"description": "Clickjacking protection: \"deny\" - no rendering within a frame, \"sameorigin\" - no rendering if origin mismatch"
},
{
"key": "api-supported-versions",
"value": "5.0",
"name": "api-supported-versions",
"description": "Custom header"
}
],
"cookie": [
{
"expires": "Wed Dec 19 2018 11:35:02 GMT-0600 (Central Standard Time)",
"httpOnly": true,
"domain": "uipath.com",
"path": "/",
"secure": true,
"value": "d3b89a558feb68050f4b847c971f595771513704902",
"key": "__cfduid"
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/QueueProcessingRecords",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/api/RobotsService",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/Processes",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/Settings",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/Robots",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/Queues",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/Assets",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/api/Account",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/Users",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata/Jobs",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/api/Logs",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/Account",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/odata",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/api",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/",
"secure": false,
"value": "",
"key": ""
},
{
"expires": "Mon Jan 18 2038 21:14:07 GMT-0600 (Central Standard Time)",
"httpOnly": false,
"domain": "platform.uipath.com",
"path": "/",
"secure": false,
"value": "GC-osp2U-YDhoXTOqXnUp3DaN1cN_siVCaNVue_jljOcqJLYHQrRk5msz52KHL8XauydRYx_3JyjLtLDpItypCPdEL20jFnxlF2g-f86Qk41",
"key": "__RequestVerificationToken"
}
],
"body": "{\r\n \"@odata.context\": \"https://platform.uipath.com/deanmauro/dean/odata/$metadata#Assets\",\r\n \"@odata.count\": 2,\r\n \"value\": [\r\n {\r\n \"Name\": \"Asset 2\",\r\n \"CanBeDeleted\": true,\r\n \"ValueScope\": \"Global\",\r\n \"ValueType\": \"Text\",\r\n \"Value\": \"I would not, Cassius, yet I love him well.\",\r\n \"StringValue\": \"I would not, Cassius, yet I love him well.\",\r\n \"BoolValue\": false,\r\n \"IntValue\": 0,\r\n \"CredentialUsername\": \"\",\r\n \"CredentialPassword\": \"\",\r\n \"ExternalName\": \"\",\r\n \"CredentialStoreId\": null,\r\n \"HasDefaultValue\": true,\r\n \"Description\": null,\r\n \"Id\": 8588,\r\n \"KeyValueList\": [],\r\n \"RobotValues\": []\r\n },\r\n {\r\n \"Name\": \"blah\",\r\n \"CanBeDeleted\": true,\r\n \"ValueScope\": \"PerRobot\",\r\n \"ValueType\": \"Integer\",\r\n \"Value\": null,\r\n \"StringValue\": \"\",\r\n \"BoolValue\": false,\r\n \"IntValue\": 0,\r\n \"CredentialUsername\": \"\",\r\n \"CredentialPassword\": \"\",\r\n \"ExternalName\": \"\",\r\n \"CredentialStoreId\": null,\r\n \"HasDefaultValue\": false,\r\n \"Description\": null,\r\n \"Id\": 23656,\r\n \"KeyValueList\": [],\r\n \"RobotValues\": [\r\n {\r\n \"RobotId\": 33530,\r\n \"RobotName\": \"joe\",\r\n \"KeyTrail\": \"***4ef589a\",\r\n \"ValueType\": \"Integer\",\r\n \"StringValue\": \"\",\r\n \"BoolValue\": false,\r\n \"IntValue\": 1,\r\n \"Value\": \"1\",\r\n \"CredentialUsername\": \"\",\r\n \"CredentialPassword\": \"\",\r\n \"ExternalName\": \"\",\r\n \"CredentialStoreId\": null,\r\n \"Id\": 199104,\r\n \"KeyValueList\": []\r\n },\r\n {\r\n \"RobotId\": 42307,\r\n \"RobotName\": \"jose\",\r\n \"KeyTrail\": \"***88bvb04\",\r\n \"ValueType\": \"Integer\",\r\n \"StringValue\": \"\",\r\n \"BoolValue\": false,\r\n \"IntValue\": 2,\r\n \"Value\": \"2\",\r\n \"CredentialUsername\": \"\",\r\n \"CredentialPassword\": \"\",\r\n \"ExternalName\": \"\",\r\n \"CredentialStoreId\": null,\r\n \"Id\": 199105,\r\n \"KeyValueList\": []\r\n }\r\n ]\r\n }\r\n ]\r\n}"
}
]
}