Chilkat Online Tools

PowerBuilder / Orchestrator / Folders - Get all

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

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

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://domain.com/odata/Folders",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

Write-Debug "Response status code = " + string(loo_Http.LastStatus)
Write-Debug loo_SbResponseBody.GetAsString()


destroy loo_Http
destroy loo_SbResponseBody

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}"
    }
  ]
}