Chilkat Online Tools

unicodeCpp / Orchestrator / Queues Items- Get all by queue id

Back to Collection Items

#include <CkHttpW.h>
#include <CkJsonObjectW.h>
#include <CkHttpResponseW.h>
#include <CkStringBuilderW.h>

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

    CkHttpW http;
    bool success;

    CkJsonObjectW queryParams;
    queryParams.UpdateString(L"$filter",L"QueueDefinitionId eq 33196");

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

    CkHttpResponseW *resp = http.QuickRequestParams(L"GET",L"https://domain.com/odata/QueueItems",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    CkStringBuilderW sbResponseBody;
    resp->GetBodySb(sbResponseBody);

    CkJsonObjectW jResp;
    jResp.LoadSb(sbResponseBody);
    jResp.put_EmitCompact(false);

    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",jResp.emit());

    int respStatusCode = resp->get_StatusCode();
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",resp->header());
        wprintf(L"Failed.\n");
        delete resp;
        return;
    }

    delete resp;

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

    // {
    //   "@odata.context": "https://platform.uipath.com/odata/$metadata#QueueItems",
    //   "@odata.count": 1,
    //   "value": [
    //     {
    //       "QueueDefinitionId": 33196,
    //       "OutputData": null,
    //       "Status": "New",
    //       "ReviewStatus": "None",
    //       "ReviewerUserId": null,
    //       "Key": "7aa9a82d-781b-45e5-ba14-d1758825e314",
    //       "Reference": null,
    //       "ProcessingExceptionType": null,
    //       "DueDate": null,
    //       "Priority": "Normal",
    //       "DeferDate": null,
    //       "StartProcessing": null,
    //       "EndProcessing": null,
    //       "SecondsInPreviousAttempts": 0,
    //       "AncestorId": null,
    //       "RetryNumber": 0,
    //       "SpecificData": "{\"DynamicProperties\":{\"Type\":\"Customer\",\"Name\":\"Some Guy\"}}",
    //       "CreationTime": "2018-07-31T12:39:07.693Z",
    //       "Progress": null,
    //       "RowVersion": "AAAAAADu9Mg=",
    //       "Id": 3888968,
    //       "ProcessingException": null,
    //       "SpecificContent": {
    //         "Type": "Customer",
    //         "Name": "Some Guy"
    //       },
    //       "Output": null
    //     }
    //   ]
    // }

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

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.

    int QueueDefinitionId;
    const wchar_t *OutputData = 0;
    const wchar_t *Status = 0;
    const wchar_t *ReviewStatus = 0;
    const wchar_t *ReviewerUserId = 0;
    const wchar_t *Key = 0;
    const wchar_t *Reference = 0;
    const wchar_t *ProcessingExceptionType = 0;
    const wchar_t *DueDate = 0;
    const wchar_t *Priority = 0;
    const wchar_t *DeferDate = 0;
    const wchar_t *StartProcessing = 0;
    const wchar_t *EndProcessing = 0;
    int SecondsInPreviousAttempts;
    const wchar_t *AncestorId = 0;
    int RetryNumber;
    const wchar_t *SpecificData = 0;
    const wchar_t *CreationTime = 0;
    const wchar_t *Progress = 0;
    const wchar_t *RowVersion = 0;
    int Id;
    const wchar_t *ProcessingException = 0;
    const wchar_t *v_Type = 0;
    const wchar_t *Name = 0;
    const wchar_t *Output = 0;

    const wchar_t *odata_context = jResp.stringOf(L"\"@odata.context\"");
    int odata_count = jResp.IntOf(L"\"@odata.count\"");
    int i = 0;
    int count_i = jResp.SizeOfArray(L"value");
    while (i < count_i) {
        jResp.put_I(i);
        QueueDefinitionId = jResp.IntOf(L"value[i].QueueDefinitionId");
        OutputData = jResp.stringOf(L"value[i].OutputData");
        Status = jResp.stringOf(L"value[i].Status");
        ReviewStatus = jResp.stringOf(L"value[i].ReviewStatus");
        ReviewerUserId = jResp.stringOf(L"value[i].ReviewerUserId");
        Key = jResp.stringOf(L"value[i].Key");
        Reference = jResp.stringOf(L"value[i].Reference");
        ProcessingExceptionType = jResp.stringOf(L"value[i].ProcessingExceptionType");
        DueDate = jResp.stringOf(L"value[i].DueDate");
        Priority = jResp.stringOf(L"value[i].Priority");
        DeferDate = jResp.stringOf(L"value[i].DeferDate");
        StartProcessing = jResp.stringOf(L"value[i].StartProcessing");
        EndProcessing = jResp.stringOf(L"value[i].EndProcessing");
        SecondsInPreviousAttempts = jResp.IntOf(L"value[i].SecondsInPreviousAttempts");
        AncestorId = jResp.stringOf(L"value[i].AncestorId");
        RetryNumber = jResp.IntOf(L"value[i].RetryNumber");
        SpecificData = jResp.stringOf(L"value[i].SpecificData");
        CreationTime = jResp.stringOf(L"value[i].CreationTime");
        Progress = jResp.stringOf(L"value[i].Progress");
        RowVersion = jResp.stringOf(L"value[i].RowVersion");
        Id = jResp.IntOf(L"value[i].Id");
        ProcessingException = jResp.stringOf(L"value[i].ProcessingException");
        v_Type = jResp.stringOf(L"value[i].SpecificContent.Type");
        Name = jResp.stringOf(L"value[i].SpecificContent.Name");
        Output = jResp.stringOf(L"value[i].Output");
        i = i + 1;
    }
    }

Curl Command

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

Postman Collection Item JSON

{
  "name": "Queues Items- Get all by queue id",
  "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/QueueItems?$filter=QueueDefinitionId eq 33196",
      "host": [
        "{{url}}"
      ],
      "path": [
        "odata",
        "QueueItems"
      ],
      "query": [
        {
          "key": "$filter",
          "value": "QueueDefinitionId eq 33196"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Queues Items- Get all by queue id",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "disabled": false
          }
        ],
        "url": {
          "raw": "{{url}}/odata/QueueItems?$filter=QueueDefinitionId eq 33196",
          "host": [
            "{{url}}"
          ],
          "path": [
            "odata",
            "QueueItems"
          ],
          "query": [
            {
              "key": "$filter",
              "value": "QueueDefinitionId eq 33196"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "CF-RAY",
          "value": "44302246a9fb91fa-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": "609",
          "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:40:30 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": "{\"@odata.context\":\"https://platform.uipath.com/odata/$metadata#QueueItems\",\"@odata.count\":1,\"value\":[{\"QueueDefinitionId\":33196,\"OutputData\":null,\"Status\":\"New\",\"ReviewStatus\":\"None\",\"ReviewerUserId\":null,\"Key\":\"7aa9a82d-781b-45e5-ba14-d1758825e314\",\"Reference\":null,\"ProcessingExceptionType\":null,\"DueDate\":null,\"Priority\":\"Normal\",\"DeferDate\":null,\"StartProcessing\":null,\"EndProcessing\":null,\"SecondsInPreviousAttempts\":0,\"AncestorId\":null,\"RetryNumber\":0,\"SpecificData\":\"{\\\"DynamicProperties\\\":{\\\"Type\\\":\\\"Customer\\\",\\\"Name\\\":\\\"Some Guy\\\"}}\",\"CreationTime\":\"2018-07-31T12:39:07.693Z\",\"Progress\":null,\"RowVersion\":\"AAAAAADu9Mg=\",\"Id\":3888968,\"ProcessingException\":null,\"SpecificContent\":{\"Type\":\"Customer\",\"Name\":\"Some Guy\"},\"Output\":null}]}"
    }
  ]
}