Chilkat Online Tools

C# / Orchestrator / Releases - Get by name

Back to Collection Items

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

Chilkat.Http http = new Chilkat.Http();
bool success;

Chilkat.JsonObject queryParams = new Chilkat.JsonObject();
queryParams.UpdateString("$filter","ProcessKey eq 'Heyyo'");

http.SetRequestHeader("Content-Type","application/json");
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";
http.SetRequestHeader("X-UIPATH-OrganizationUnitId","{{folderId}}");
http.SetRequestHeader("X-UIPATH-TenantName","{{tenantName}}");

Chilkat.HttpResponse resp = http.QuickRequestParams("GET","https://domain.com/odata/Releases",queryParams);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
resp.GetBodySb(sbResponseBody);

Chilkat.JsonObject jResp = new Chilkat.JsonObject();
jResp.LoadSb(sbResponseBody);
jResp.EmitCompact = false;

Debug.WriteLine("Response Body:");
Debug.WriteLine(jResp.Emit());

int respStatusCode = resp.StatusCode;
Debug.WriteLine("Response Status Code = " + Convert.ToString(respStatusCode));
if (respStatusCode >= 400) {
    Debug.WriteLine("Response Header:");
    Debug.WriteLine(resp.Header);
    Debug.WriteLine("Failed.");

    return;
}

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

// {
//   "@odata.context": "https://platform.uipath.com/odata/$metadata#Releases",
//   "@odata.count": 1,
//   "value": [
//     {
//       "Key": "012345a-678-89b9-b738-4574466f4886",
//       "ProcessKey": "Hello",
//       "ProcessVersion": "1.0.6913.24377",
//       "IsLatestVersion": false,
//       "IsProcessDeleted": false,
//       "Description": null,
//       "Name": "Hello_playground",
//       "EnvironmentId": 3210,
//       "EnvironmentName": "playground",
//       "InputArguments": "{}",
//       "QueueDefinitionId": null,
//       "QueueDefinitionName": null,
//       "Id": 12345,
//       "Arguments": {
//         "Input": "[{\"name\":\"greeting\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"url\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"username\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":true},{\"name\":\"password\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":true}]",
//         "Output": "[{\"name\":\"greeting\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false}]"
//       },
//       "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;
bool IsLatestVersion;
bool IsProcessDeleted;
string Description;
string Name;
int EnvironmentId;
string EnvironmentName;
string InputArguments;
string QueueDefinitionId;
string QueueDefinitionName;
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.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.IntOf("value[i].EnvironmentId");
    EnvironmentName = jResp.StringOf("value[i].EnvironmentName");
    InputArguments = jResp.StringOf("value[i].InputArguments");
    QueueDefinitionId = jResp.StringOf("value[i].QueueDefinitionId");
    QueueDefinitionName = jResp.StringOf("value[i].QueueDefinitionName");
    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;
}

Curl Command

curl -G -d "$filter=ProcessKey%20eq%20%27Heyyo%27"
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-H "X-UIPATH-TenantName: {{tenantName}}"
	-H "X-UIPATH-OrganizationUnitId: {{folderId}}"
https://domain.com/odata/Releases

Postman Collection Item JSON

{
  "name": "Releases - Get by name",
  "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/Releases?$filter=ProcessKey eq 'Heyyo'",
      "host": [
        "{{url}}"
      ],
      "path": [
        "odata",
        "Releases"
      ],
      "query": [
        {
          "key": "$filter",
          "value": "ProcessKey eq 'Heyyo'"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Releases - Get by name",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{url}}/odata/Releases?$filter=ProcessKey eq 'Hello'",
          "host": [
            "{{url}}"
          ],
          "path": [
            "odata",
            "Releases"
          ],
          "query": [
            {
              "key": "$filter",
              "value": "ProcessKey eq 'Hello'"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "CF-RAY",
          "value": "44302d9c2b8e91d0-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": "381",
          "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:48:14 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": "{\n    \"@odata.context\": \"https://platform.uipath.com/odata/$metadata#Releases\",\n    \"@odata.count\": 1,\n    \"value\": [\n        {\n            \"Key\": \"012345a-678-89b9-b738-4574466f4886\",\n            \"ProcessKey\": \"Hello\",\n            \"ProcessVersion\": \"1.0.6913.24377\",\n            \"IsLatestVersion\": false,\n            \"IsProcessDeleted\": false,\n            \"Description\": null,\n            \"Name\": \"Hello_playground\",\n            \"EnvironmentId\": 3210,\n            \"EnvironmentName\": \"playground\",\n            \"InputArguments\": \"{}\",\n            \"QueueDefinitionId\": null,\n            \"QueueDefinitionName\": null,\n            \"Id\": 12345,\n            \"Arguments\": {\n                \"Input\": \"[{\\\"name\\\":\\\"greeting\\\",\\\"type\\\":\\\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\\\",\\\"required\\\":false,\\\"hasDefault\\\":false},{\\\"name\\\":\\\"url\\\",\\\"type\\\":\\\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\\\",\\\"required\\\":false,\\\"hasDefault\\\":false},{\\\"name\\\":\\\"username\\\",\\\"type\\\":\\\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\\\",\\\"required\\\":false,\\\"hasDefault\\\":true},{\\\"name\\\":\\\"password\\\",\\\"type\\\":\\\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\\\",\\\"required\\\":false,\\\"hasDefault\\\":true}]\",\n                \"Output\": \"[{\\\"name\\\":\\\"greeting\\\",\\\"type\\\":\\\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\\\",\\\"required\\\":false,\\\"hasDefault\\\":false}]\"\n            },\n            \"ProcessSettings\": null\n        }\n    ]\n}"
    }
  ]
}