Chilkat Online Tools

Node.js / Orchestrator / Folders - Get all

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

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

    var sbResponseBody = new chilkat.StringBuilder();
    success = http.QuickGetSb("https://domain.com/odata/Folders",sbResponseBody);
    if (success == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log("Response status code = " + http.LastStatus);
    console.log(sbResponseBody.GetAsString());

}

chilkatExample();

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-H "X-UIPATH-TenantName: {{tenantName}}"
https://domain.com/odata/Folders

Postman Collection Item JSON

{
  "name": "Folders - Get all",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "X-UIPATH-TenantName",
        "value": "{{tenantName}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/odata/Folders",
      "host": [
        "{{url}}"
      ],
      "path": [
        "odata",
        "Folders"
      ]
    },
    "description": "Experimental Feature: Retrieves all Organization Units."
  },
  "response": [
    {
      "name": "Organization Units - Get all",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "type": "text",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{url}}/odata/OrganizationUnits",
          "host": [
            "{{url}}"
          ],
          "path": [
            "odata",
            "OrganizationUnits"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "html",
      "header": [
        {
          "key": "Date",
          "value": "Wed, 27 Feb 2019 13:49:44 GMT"
        },
        {
          "key": "Content-Type",
          "value": "text/html; charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "1028"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache, no-store, must-revalidate"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Expires",
          "value": "-1"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Set-Cookie",
          "value": "XSRF-TOKEN=eJhbVvmvo60rErmC3ydbu-EewNysAnyf6tCKVomQvy2n_wBJwC_MQ081rGozSsQ0cryKgfkNmzTmo373xIZ0cwh9Z_rgUXedq8C0YcSTa5PVnatXsl0ELqFvp0aXZG96RXPx9CLeUj_hnbXAZbWC4w2; path=/; secure; SameSite=lax"
        },
        {
          "key": "X-Robots-Tag",
          "value": "noindex, nofollow"
        },
        {
          "key": "X-Download-Options",
          "value": "noopen"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Content-Security-Policy",
          "value": "default-src 'self';script-src 'self' cdn.mxpnl.com;style-src 'self' 'unsafe-inline';img-src 'self' data:;connect-src 'self' ws: wss: api.mixpanel.com https: sentry.io"
        },
        {
          "key": "Request-Context",
          "value": "appId=cid-v1:d00ce63d-0891-41e4-a17c-25b2c5382e49"
        },
        {
          "key": "Access-Control-Expose-Headers",
          "value": "Request-Context"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-Frame-Options",
          "value": "DENY"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=31536000; includeSubDomains"
        },
        {
          "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": "4afb1dd2abf16439-FRA"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"@odata.context\": \"https://beta.uipath.com/odata/$metadata#OrganizationUnits\",\n    \"@odata.count\": 2,\n    \"value\": [\n        {\n            \"DisplayName\": \"Default\",\n            \"Id\": 715\n        },\n        {\n            \"DisplayName\": \"a\",\n            \"Id\": 846\n        }\n    ]\n}"
    }
  ]
}