Chilkat Online Tools

Android / Orchestrator API Documentation / Get Releases by Name

Back to Collection Items

// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    CkHttp http = new CkHttp();
    boolean success;

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateString("$filter","Name eq 'Add a pet to pet store by queue item'");

    // Adds the "Authorization: Bearer <access_token>" header.
    http.put_AuthToken("<access_token>");
    http.SetRequestHeader("X-UIPATH-OrganizationUnitId","{{folderId}}");

    CkHttpResponse resp = http.QuickRequestParams("GET","https://domain.com/odata/Releases",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());
        return;
        }

    CkStringBuilder sbResponseBody = new CkStringBuilder();
    resp.GetBodySb(sbResponseBody);

    CkJsonObject jResp = new CkJsonObject();
    jResp.LoadSb(sbResponseBody);
    jResp.put_EmitCompact(false);

    Log.i(TAG, "Response Body:");
    Log.i(TAG, jResp.emit());

    int respStatusCode = resp.get_StatusCode();
    Log.i(TAG, "Response Status Code = " + String.valueOf(respStatusCode));
    if (respStatusCode >= 400) {
        Log.i(TAG, "Response Header:");
        Log.i(TAG, resp.header());
        Log.i(TAG, "Failed.");

        return;
        }

    // 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": "6f459380-1b98-4f33-9682-6f8a7457490f",
    //       "ProcessKey": "PetStore_AddPet_byQueueItem",
    //       "ProcessVersion": "1.0.13",
    //       "IsLatestVersion": false,
    //       "IsProcessDeleted": false,
    //       "Description": "Gets a queue item and adds a pet with item name",
    //       "Name": "Add a pet to pet store by queue item",
    //       "EnvironmentId": null,
    //       "EnvironmentName": "",
    //       "EntryPointId": null,
    //       "InputArguments": null,
    //       "ProcessType": "Process",
    //       "SupportsMultipleEntryPoints": true,
    //       "RequiresUserInteraction": true,
    //       "AutoUpdate": false,
    //       "FeedId": "ef94e92f-5f58-474b-963c-c3ef46391ca7",
    //       "JobPriority": "Normal",
    //       "CreationTime": "2021-03-16T09:04:00.607Z",
    //       "OrganizationUnitId": 515128,
    //       "OrganizationUnitFullyQualifiedName": "UnattendedProcesses",
    //       "Id": 31025,
    //       "Arguments": {
    //         "Input": null,
    //         "Output": null
    //       },
    //       "ProcessSettings": null
    //     }
    //   ]
    // }

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

    String Key;
    String ProcessKey;
    String ProcessVersion;
    boolean IsLatestVersion;
    boolean IsProcessDeleted;
    String Description;
    String Name;
    String EnvironmentId;
    String EnvironmentName;
    String EntryPointId;
    String InputArguments;
    String ProcessType;
    boolean SupportsMultipleEntryPoints;
    boolean RequiresUserInteraction;
    boolean AutoUpdate;
    String FeedId;
    String JobPriority;
    String CreationTime;
    int OrganizationUnitId;
    String OrganizationUnitFullyQualifiedName;
    int Id;
    String Input;
    String Output;
    String ProcessSettings;

    String odata_context = jResp.stringOf("\"@odata.context\"");
    int odata_count = jResp.IntOf("\"@odata.count\"");
    int i = 0;
    int count_i = jResp.SizeOfArray("value");
    while (i < count_i) {
        jResp.put_I(i);
        Key = jResp.stringOf("value[i].Key");
        ProcessKey = jResp.stringOf("value[i].ProcessKey");
        ProcessVersion = jResp.stringOf("value[i].ProcessVersion");
        IsLatestVersion = jResp.BoolOf("value[i].IsLatestVersion");
        IsProcessDeleted = jResp.BoolOf("value[i].IsProcessDeleted");
        Description = jResp.stringOf("value[i].Description");
        Name = jResp.stringOf("value[i].Name");
        EnvironmentId = jResp.stringOf("value[i].EnvironmentId");
        EnvironmentName = jResp.stringOf("value[i].EnvironmentName");
        EntryPointId = jResp.stringOf("value[i].EntryPointId");
        InputArguments = jResp.stringOf("value[i].InputArguments");
        ProcessType = jResp.stringOf("value[i].ProcessType");
        SupportsMultipleEntryPoints = jResp.BoolOf("value[i].SupportsMultipleEntryPoints");
        RequiresUserInteraction = jResp.BoolOf("value[i].RequiresUserInteraction");
        AutoUpdate = jResp.BoolOf("value[i].AutoUpdate");
        FeedId = jResp.stringOf("value[i].FeedId");
        JobPriority = jResp.stringOf("value[i].JobPriority");
        CreationTime = jResp.stringOf("value[i].CreationTime");
        OrganizationUnitId = jResp.IntOf("value[i].OrganizationUnitId");
        OrganizationUnitFullyQualifiedName = jResp.stringOf("value[i].OrganizationUnitFullyQualifiedName");
        Id = jResp.IntOf("value[i].Id");
        Input = jResp.stringOf("value[i].Arguments.Input");
        Output = jResp.stringOf("value[i].Arguments.Output");
        ProcessSettings = jResp.stringOf("value[i].ProcessSettings");
        i = i + 1;
        }


  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}

Curl Command

curl -G -d "$filter=Name%20eq%20%27Add%20a%20pet%20to%20pet%20store%20by%20queue%20item%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"
      }
    ],
    "url": {
      "raw": "{{url}}/odata/Releases?$filter=Name eq 'Add a pet to pet store by queue item'",
      "host": [
        "{{url}}"
      ],
      "path": [
        "odata",
        "Releases"
      ],
      "query": [
        {
          "key": "$filter",
          "value": "Name eq 'Add a pet to pet store by queue item'"
        }
      ]
    },
    "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."
  },
  "response": [
    {
      "name": "Get Releases by Name Copy",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "X-UIPATH-TenantName",
            "value": "{{tenantName}}",
            "type": "text"
          },
          {
            "key": "X-UIPATH-OrganizationUnitId",
            "value": "{{folderId}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{url}}/odata/Releases?$filter=Name eq 'Add a pet to pet store by queue item'",
          "host": [
            "{{url}}"
          ],
          "path": [
            "odata",
            "Releases"
          ],
          "query": [
            {
              "key": "$filter",
              "value": "Name eq 'Add a pet to pet store by queue item'"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Wed, 31 Mar 2021 12:54:04 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": "d38b319c-dac3-46d0-bf60-a4b3b18902f1"
        },
        {
          "key": "OData-Version",
          "value": "4.0"
        },
        {
          "key": "api-supported-versions",
          "value": "12.0"
        },
        {
          "key": "CF-Cache-Status",
          "value": "DYNAMIC"
        },
        {
          "key": "cf-request-id",
          "value": "0929f232600000cba0252ce000000001"
        },
        {
          "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": "6389b963ce2fcba0-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\": \"6f459380-1b98-4f33-9682-6f8a7457490f\",\n            \"ProcessKey\": \"PetStore_AddPet_byQueueItem\",\n            \"ProcessVersion\": \"1.0.13\",\n            \"IsLatestVersion\": false,\n            \"IsProcessDeleted\": false,\n            \"Description\": \"Gets a queue item and adds a pet with item name\",\n            \"Name\": \"Add a pet to pet store by queue item\",\n            \"EnvironmentId\": null,\n            \"EnvironmentName\": \"\",\n            \"EntryPointId\": null,\n            \"InputArguments\": null,\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-03-16T09:04:00.607Z\",\n            \"OrganizationUnitId\": 515128,\n            \"OrganizationUnitFullyQualifiedName\": \"UnattendedProcesses\",\n            \"Id\": 31025,\n            \"Arguments\": {\n                \"Input\": null,\n                \"Output\": null\n            },\n            \"ProcessSettings\": null\n        }\n    ]\n}"
    }
  ]
}