Chilkat Online Tools

autoit / Orchestrator API Documentation / Get Releases by Name

Back to Collection Items

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oQueryParams = ObjCreate("Chilkat_9_5_0.JsonObject")
$oQueryParams.UpdateString("$filter","Name eq 'DataTableArguments'")

; Adds the "Authorization: Bearer <access_token>" header.
$oHttp.AuthToken = "<access_token>"
$oHttp.SetRequestHeader "X-UIPATH-OrganizationUnitId","{{folderId}}"

Local $oResp = $oHttp.QuickRequestParams("GET","https://domain.com/odata/Releases",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oResp.GetBodySb($oSbResponseBody)

$oJResp = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)

Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oResp.Header & @CRLF)
    ConsoleWrite("Failed." & @CRLF)

    Exit
EndIf

; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)

; {
;   "@odata.context": "https://cloud.uipath.com/org/tenant/orchestrator_/odata/$metadata#Releases",
;   "@odata.count": 1,
;   "value": [
;     {
;       "Key": "ee675fae-e5da-4a0e-aac5-31f27182ecba",
;       "ProcessKey": "DataTableArguments",
;       "ProcessVersion": "1.0.4",
;       "IsLatestVersion": false,
;       "IsProcessDeleted": false,
;       "Description": "Takes over arguments and writes it into asset \"InputArgs\"",
;       "Name": "DataTableArguments",
;       "EnvironmentId": null,
;       "EnvironmentName": "",
;       "EntryPointId": 129015,
;       "InputArguments": "{\"dt_Arguments\":{\"InventoryData\":[{\"Product ID\":\"OFF-PA-10002001\",\"Measure Names\":\"Sales Forecast\",\"Measure Values\":\"$19\"},{\"Product ID\":\"OFF-PA-10002001\",\"Measure Names\":\"Quantity\",\"Measure Values\":\"2\"}]}}",
;       "ProcessType": "Process",
;       "SupportsMultipleEntryPoints": true,
;       "RequiresUserInteraction": true,
;       "AutoUpdate": false,
;       "FeedId": "ef94e92f-5f58-474b-963c-c3ef46391ca7",
;       "JobPriority": "Normal",
;       "CreationTime": "2021-04-20T09:22:10.087Z",
;       "OrganizationUnitId": 515128,
;       "OrganizationUnitFullyQualifiedName": "UnattendedProcesses",
;       "Id": 36935,
;       "Arguments": {
;         "Input": "[\r\n  {\r\n    \"name\": \"dt_Arguments\",\r\n    \"type\": \"System.Data.DataTable, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\r\n    \"required\": false,\r\n    \"hasDefault\": false\r\n  }\r\n]",
;         "Output": "[]"
;       },
;       "ProcessSettings": null
;     }
;   ]
; }

; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

Local $sKey
Local $sProcessKey
Local $sProcessVersion
Local $bIsLatestVersion
Local $bIsProcessDeleted
Local $sDescription
Local $sName
Local $sEnvironmentId
Local $sEnvironmentName
Local $iEntryPointId
Local $sInputArguments
Local $sProcessType
Local $bSupportsMultipleEntryPoints
Local $bRequiresUserInteraction
Local $bAutoUpdate
Local $sFeedId
Local $sJobPriority
Local $sCreationTime
Local $iOrganizationUnitId
Local $sOrganizationUnitFullyQualifiedName
Local $iId
Local $sInput
Local $sOutput
Local $sProcessSettings

Local $sOdata_context = $oJResp.StringOf("""@odata.context""")
Local $iOdata_count = $oJResp.IntOf("""@odata.count""")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("value")
While $i < $iCount_i
    $oJResp.I = $i
    $sKey = $oJResp.StringOf("value[i].Key")
    $sProcessKey = $oJResp.StringOf("value[i].ProcessKey")
    $sProcessVersion = $oJResp.StringOf("value[i].ProcessVersion")
    $bIsLatestVersion = $oJResp.BoolOf("value[i].IsLatestVersion")
    $bIsProcessDeleted = $oJResp.BoolOf("value[i].IsProcessDeleted")
    $sDescription = $oJResp.StringOf("value[i].Description")
    $sName = $oJResp.StringOf("value[i].Name")
    $sEnvironmentId = $oJResp.StringOf("value[i].EnvironmentId")
    $sEnvironmentName = $oJResp.StringOf("value[i].EnvironmentName")
    $iEntryPointId = $oJResp.IntOf("value[i].EntryPointId")
    $sInputArguments = $oJResp.StringOf("value[i].InputArguments")
    $sProcessType = $oJResp.StringOf("value[i].ProcessType")
    $bSupportsMultipleEntryPoints = $oJResp.BoolOf("value[i].SupportsMultipleEntryPoints")
    $bRequiresUserInteraction = $oJResp.BoolOf("value[i].RequiresUserInteraction")
    $bAutoUpdate = $oJResp.BoolOf("value[i].AutoUpdate")
    $sFeedId = $oJResp.StringOf("value[i].FeedId")
    $sJobPriority = $oJResp.StringOf("value[i].JobPriority")
    $sCreationTime = $oJResp.StringOf("value[i].CreationTime")
    $iOrganizationUnitId = $oJResp.IntOf("value[i].OrganizationUnitId")
    $sOrganizationUnitFullyQualifiedName = $oJResp.StringOf("value[i].OrganizationUnitFullyQualifiedName")
    $iId = $oJResp.IntOf("value[i].Id")
    $sInput = $oJResp.StringOf("value[i].Arguments.Input")
    $sOutput = $oJResp.StringOf("value[i].Arguments.Output")
    $sProcessSettings = $oJResp.StringOf("value[i].ProcessSettings")
    $i = $i + 1
Wend

Curl Command

curl -G -d "$filter=Name%20eq%20%27DataTableArguments%27"
	-H "Authorization: Bearer <access_token>"
	-H "X-UIPATH-OrganizationUnitId: {{folderId}}"
https://domain.com/odata/Releases

Postman Collection Item JSON

{
  "name": "Get Releases by Name",
  "event": [
    {
      "listen": "test",
      "script": {
        "exec": [
          "pm.test(\"Status code is 200\", function () {\r",
          "    pm.response.to.have.status(200);\r",
          "});\r",
          "\r",
          "//set release key\r",
          "var myResponse = pm.response.json();\r",
          "pm.collectionVariables.set(\"releaseKey\", myResponse.value[0].Key);\r",
          "console.log(pm.collectionVariables.get(\"releaseKey\"));"
        ],
        "type": "text/javascript"
      }
    },
    {
      "listen": "prerequest",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "X-UIPATH-OrganizationUnitId",
        "value": "{{folderId}}",
        "type": "text",
        "disabled": true
      }
    ],
    "url": {
      "raw": "{{url}}/odata/Releases?$filter=Name eq 'DataTableArguments'",
      "host": [
        "{{url}}"
      ],
      "path": [
        "odata",
        "Releases"
      ],
      "query": [
        {
          "key": "$filter",
          "value": "Name eq 'DataTableArguments'"
        }
      ]
    },
    "description": "So you've created a **Process** in UiPath Studio and published it to Orchestrator. Here's where you specify that process, by name, in order to start it remotely.\n\nWithin the URL, simply replace the string in the filter parameter with the name of your process and this call will return the `ReleaseKey` that you will need in step 3 to start the process.\n\nThe process arguments listed in the response property `Arguments` can be used to render a user interface. This allows to dyamically render a process user interface.\n\nIn this example we are using a simple `string`: status as process input argument. Simple input arguments are listed as key value pairs."
  },
  "response": [
    {
      "name": "Get Releases by Name",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "X-UIPATH-OrganizationUnitId",
            "value": "{{folderId}}",
            "type": "text",
            "disabled": true
          }
        ],
        "url": {
          "raw": "{{url}}/odata/Releases?$filter=Name eq 'DataTableArguments'",
          "host": [
            "{{url}}"
          ],
          "path": [
            "odata",
            "Releases"
          ],
          "query": [
            {
              "key": "$filter",
              "value": "Name eq 'DataTableArguments'"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Tue, 20 Apr 2021 12:55:48 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json; odata.metadata=minimal; odata.streaming=true"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache, no-store, must-revalidate"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Expires",
          "value": "-1"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Request-Context",
          "value": "appId=cid-v1:04884d99-0742-441b-a23c-847133cb0130"
        },
        {
          "key": "X-Robots-Tag",
          "value": "noindex,nofollow"
        },
        {
          "key": "X-Download-Options",
          "value": "noopen"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-Frame-Options",
          "value": "Deny"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=31536000; includeSubDomains"
        },
        {
          "key": "Content-Security-Policy",
          "value": "default-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: https://*.blob.core.windows.net https://*.amazonaws.com blob:;font-src 'self' data:;connect-src 'self' wss: https://sentry.io https://studio-feedback.azure-api.net https://storage.googleapis.com https://*.service.signalr.net https://*.blob.core.windows.net https://*.amazonaws.com dc.services.visualstudio.com;worker-src 'self' blob:"
        },
        {
          "key": "X-Correlation-ID",
          "value": "7886735d-62ef-41bd-be3f-530e9163b11f"
        },
        {
          "key": "OData-Version",
          "value": "4.0"
        },
        {
          "key": "api-supported-versions",
          "value": "12.0"
        },
        {
          "key": "CF-Cache-Status",
          "value": "DYNAMIC"
        },
        {
          "key": "cf-request-id",
          "value": "0990f2fae600000fa65c96d000000001"
        },
        {
          "key": "Expect-CT",
          "value": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""
        },
        {
          "key": "Server",
          "value": "cloudflare"
        },
        {
          "key": "CF-RAY",
          "value": "642e87716cf90fa6-VIE"
        },
        {
          "key": "Content-Encoding",
          "value": "br"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"@odata.context\": \"https://cloud.uipath.com/org/tenant/orchestrator_/odata/$metadata#Releases\",\n    \"@odata.count\": 1,\n    \"value\": [\n        {\n            \"Key\": \"ee675fae-e5da-4a0e-aac5-31f27182ecba\",\n            \"ProcessKey\": \"DataTableArguments\",\n            \"ProcessVersion\": \"1.0.4\",\n            \"IsLatestVersion\": false,\n            \"IsProcessDeleted\": false,\n            \"Description\": \"Takes over arguments and writes it into asset \\\"InputArgs\\\"\",\n            \"Name\": \"DataTableArguments\",\n            \"EnvironmentId\": null,\n            \"EnvironmentName\": \"\",\n            \"EntryPointId\": 129015,\n            \"InputArguments\": \"{\\\"dt_Arguments\\\":{\\\"InventoryData\\\":[{\\\"Product ID\\\":\\\"OFF-PA-10002001\\\",\\\"Measure Names\\\":\\\"Sales Forecast\\\",\\\"Measure Values\\\":\\\"$19\\\"},{\\\"Product ID\\\":\\\"OFF-PA-10002001\\\",\\\"Measure Names\\\":\\\"Quantity\\\",\\\"Measure Values\\\":\\\"2\\\"}]}}\",\n            \"ProcessType\": \"Process\",\n            \"SupportsMultipleEntryPoints\": true,\n            \"RequiresUserInteraction\": true,\n            \"AutoUpdate\": false,\n            \"FeedId\": \"ef94e92f-5f58-474b-963c-c3ef46391ca7\",\n            \"JobPriority\": \"Normal\",\n            \"CreationTime\": \"2021-04-20T09:22:10.087Z\",\n            \"OrganizationUnitId\": 515128,\n            \"OrganizationUnitFullyQualifiedName\": \"UnattendedProcesses\",\n            \"Id\": 36935,\n            \"Arguments\": {\n                \"Input\": \"[\\r\\n  {\\r\\n    \\\"name\\\": \\\"dt_Arguments\\\",\\r\\n    \\\"type\\\": \\\"System.Data.DataTable, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\\\",\\r\\n    \\\"required\\\": false,\\r\\n    \\\"hasDefault\\\": false\\r\\n  }\\r\\n]\",\n                \"Output\": \"[]\"\n            },\n            \"ProcessSettings\": null\n        }\n    ]\n}"
    }
  ]
}